From b3ceb2741476209419bd210d7caebec7fbb5eaa7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 19:27:49 +0000 Subject: [PATCH 01/18] docs(client): update jackson compat error message --- orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt index df5773f18..e7d08f444 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt @@ -62,7 +62,7 @@ internal fun checkJacksonVersionCompatibility() { } check(incompatibleJacksonVersions.isEmpty()) { """ -This SDK depends on Jackson version $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime: +This SDK requires a minimum Jackson version of $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime: ${incompatibleJacksonVersions.asSequence().map { (version, incompatibilityReason) -> "- `${version.toFullString().replace("/", ":")}` ($incompatibilityReason)" From fb2505d8cdf9fb61589715396da17d424de5f7c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:08:02 +0000 Subject: [PATCH 02/18] docs: explain jackson compat in readme --- README.md | 11 +++++++++++ .../src/main/kotlin/com/withorb/api/core/Check.kt | 2 ++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 6bb662bef..3cde381be 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,17 @@ both of which will raise an error if the signature is invalid. Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). The `.unwrap()` method can parse this JSON for you. +## Jackson + +The SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default. + +The SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config). + +If the SDK threw an exception, but you're _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`OrbOkHttpClient`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt) or [`OrbOkHttpClientAsync`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt). + +> [!CAUTION] +> We make no guarantee that the SDK works correctly when the Jackson version check is disabled. + ## Network options ### Retries diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt index e7d08f444..5187003e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt @@ -73,6 +73,8 @@ This can happen if you are either: 2. Depending on some library that depends on different Jackson versions, potentially transitively Double-check that you are depending on compatible Jackson versions. + +See https://www.github.com/orbcorp/orb-java#jackson for more information. """ .trimIndent() } From f72c4ad7c4604330f2ff972b517b2e3f03f5356f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 15:32:44 +0000 Subject: [PATCH 03/18] perf(internal): improve compilation+test speed --- .github/workflows/publish-sonatype.yml | 2 +- .../src/main/kotlin/orb.kotlin.gradle.kts | 9 +-- gradle.properties | 16 +++++- .../api/core/http/RetryingHttpClient.kt | 56 ++++++++++++------- .../withorb/api/core/PhantomReachableTest.kt | 2 +- .../com/withorb/api/core/http/HeadersTest.kt | 32 ----------- .../withorb/api/core/http/QueryParamsTest.kt | 32 ----------- .../api/core/http/RetryingHttpClientTest.kt | 36 ++++++++---- .../withorb/api/services/ErrorHandlingTest.kt | 2 + .../withorb/api/services/ServiceParamsTest.kt | 2 + 10 files changed, 85 insertions(+), 104 deletions(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 66b43d31e..96822978e 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" + ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.ORB_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.ORB_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts index 55b2fc55a..ba40275a9 100644 --- a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts @@ -9,7 +9,7 @@ plugins { kotlin { jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } compilerOptions { @@ -19,6 +19,8 @@ kotlin { // Suppress deprecation warnings because we may still reference and test deprecated members. // TODO: Replace with `-Xsuppress-warning=DEPRECATION` once we use Kotlin compiler 2.1.0+. "-nowarn", + // Use as many threads as there are CPU cores on the machine for compilation. + "-Xbackend-threads=0", ) jvmTarget.set(JvmTarget.JVM_1_8) languageVersion.set(KotlinVersion.KOTLIN_1_9) @@ -34,8 +36,7 @@ configure { } } -// Run tests in parallel to some degree. tasks.withType().configureEach { - maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) - forkEvery = 100 + systemProperty("junit.jupiter.execution.parallel.enabled", true) + systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") } diff --git a/gradle.properties b/gradle.properties index 0c8d4ded7..ff76593f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,17 @@ org.gradle.caching=true +org.gradle.configuration-cache=true org.gradle.parallel=true org.gradle.daemon=false -org.gradle.jvmargs=-Xmx4g -kotlin.daemon.jvmargs=-Xmx4g +# These options improve our compilation and test performance. They are inherited by the Kotlin daemon. +org.gradle.jvmargs=\ + -Xms1g \ + -Xmx4g \ + -XX:+UseParallelGC \ + -XX:InitialCodeCacheSize=256m \ + -XX:ReservedCodeCacheSize=1G \ + -XX:MetaspaceSize=256m \ + -XX:TieredStopAtLevel=1 \ + -XX:GCTimeRatio=4 \ + -XX:CICompilerCount=4 \ + -XX:+OptimizeStringConcat \ + -XX:+UseStringDeduplication diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt index 934130924..cba6f15bc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt @@ -23,6 +23,7 @@ import kotlin.math.pow class RetryingHttpClient private constructor( private val httpClient: HttpClient, + private val sleeper: Sleeper, private val clock: Clock, private val maxRetries: Int, private val idempotencyHeader: String?, @@ -62,10 +63,10 @@ private constructor( null } - val backoffMillis = getRetryBackoffMillis(retries, response) + val backoffDuration = getRetryBackoffDuration(retries, response) // All responses must be closed, so close the failed one before retrying. response?.close() - Thread.sleep(backoffMillis.toMillis()) + sleeper.sleep(backoffDuration) } } @@ -111,10 +112,10 @@ private constructor( } } - val backoffMillis = getRetryBackoffMillis(retries, response) + val backoffDuration = getRetryBackoffDuration(retries, response) // All responses must be closed, so close the failed one before retrying. response?.close() - return sleepAsync(backoffMillis.toMillis()).thenCompose { + return sleeper.sleepAsync(backoffDuration).thenCompose { executeWithRetries(requestWithRetryCount, requestOptions) } } @@ -179,7 +180,7 @@ private constructor( // retried. throwable is IOException || throwable is OrbIoException - private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration { + private fun getRetryBackoffDuration(retries: Int, response: HttpResponse?): Duration { // About the Retry-After header: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After response @@ -226,33 +227,40 @@ private constructor( companion object { - private val TIMER = Timer("RetryingHttpClient", true) - - private fun sleepAsync(millis: Long): CompletableFuture { - val future = CompletableFuture() - TIMER.schedule( - object : TimerTask() { - override fun run() { - future.complete(null) - } - }, - millis, - ) - return future - } - @JvmStatic fun builder() = Builder() } class Builder internal constructor() { private var httpClient: HttpClient? = null + private var sleeper: Sleeper = + object : Sleeper { + + private val timer = Timer("RetryingHttpClient", true) + + override fun sleep(duration: Duration) = Thread.sleep(duration.toMillis()) + + override fun sleepAsync(duration: Duration): CompletableFuture { + val future = CompletableFuture() + timer.schedule( + object : TimerTask() { + override fun run() { + future.complete(null) + } + }, + duration.toMillis(), + ) + return future + } + } private var clock: Clock = Clock.systemUTC() private var maxRetries: Int = 2 private var idempotencyHeader: String? = null fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } + @JvmSynthetic internal fun sleeper(sleeper: Sleeper) = apply { this.sleeper = sleeper } + fun clock(clock: Clock) = apply { this.clock = clock } fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } @@ -262,9 +270,17 @@ private constructor( fun build(): HttpClient = RetryingHttpClient( checkRequired("httpClient", httpClient), + sleeper, clock, maxRetries, idempotencyHeader, ) } + + internal interface Sleeper { + + fun sleep(duration: Duration) + + fun sleepAsync(duration: Duration): CompletableFuture + } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/PhantomReachableTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/PhantomReachableTest.kt index 0398347e4..ff7f5f622 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/PhantomReachableTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/PhantomReachableTest.kt @@ -20,7 +20,7 @@ internal class PhantomReachableTest { assertThat(closed).isFalse() System.gc() - Thread.sleep(3000) + Thread.sleep(100) assertThat(closed).isTrue() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/HeadersTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/HeadersTest.kt index ef06e6ce6..6ad15e18a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/HeadersTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/HeadersTest.kt @@ -1,8 +1,6 @@ package com.withorb.api.core.http import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.catchThrowable -import org.assertj.core.api.Assumptions.assumeThat import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource @@ -241,34 +239,4 @@ internal class HeadersTest { assertThat(size).isEqualTo(testCase.expectedSize) } - - @ParameterizedTest - @EnumSource - fun namesAreImmutable(testCase: TestCase) { - val headers = testCase.headers - val headerNamesCopy = headers.names().toSet() - - val throwable = catchThrowable { - (headers.names() as MutableSet).add("another name") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(headers.names()).isEqualTo(headerNamesCopy) - } - - @ParameterizedTest - @EnumSource - fun valuesAreImmutable(testCase: TestCase) { - val headers = testCase.headers - assumeThat(headers.size).isNotEqualTo(0) - val name = headers.names().first() - val headerValuesCopy = headers.values(name).toList() - - val throwable = catchThrowable { - (headers.values(name) as MutableList).add("another value") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(headers.values(name)).isEqualTo(headerValuesCopy) - } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/QueryParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/QueryParamsTest.kt index 11c28d374..c9003c20e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/QueryParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/QueryParamsTest.kt @@ -1,8 +1,6 @@ package com.withorb.api.core.http import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.catchThrowable -import org.assertj.core.api.Assumptions.assumeThat import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource @@ -179,34 +177,4 @@ internal class QueryParamsTest { assertThat(size).isEqualTo(testCase.expectedSize) } - - @ParameterizedTest - @EnumSource - fun keysAreImmutable(testCase: TestCase) { - val queryParams = testCase.queryParams - val queryParamKeysCopy = queryParams.keys().toSet() - - val throwable = catchThrowable { - (queryParams.keys() as MutableSet).add("another key") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(queryParams.keys()).isEqualTo(queryParamKeysCopy) - } - - @ParameterizedTest - @EnumSource - fun valuesAreImmutable(testCase: TestCase) { - val queryParams = testCase.queryParams - assumeThat(queryParams.size).isNotEqualTo(0) - val key = queryParams.keys().first() - val queryParamValuesCopy = queryParams.values(key).toList() - - val throwable = catchThrowable { - (queryParams.values(key) as MutableList).add("another value") - } - - assertThat(throwable).isInstanceOf(UnsupportedOperationException::class.java) - assertThat(queryParams.values(key)).isEqualTo(queryParamValuesCopy) - } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/RetryingHttpClientTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/RetryingHttpClientTest.kt index 2311043c7..1a348919a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/RetryingHttpClientTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/RetryingHttpClientTest.kt @@ -7,13 +7,16 @@ import com.github.tomakehurst.wiremock.stubbing.Scenario import com.withorb.api.client.okhttp.OkHttpClient import com.withorb.api.core.RequestOptions import java.io.InputStream +import java.time.Duration import java.util.concurrent.CompletableFuture import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.parallel.ResourceLock import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource @WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class RetryingHttpClientTest { private var openResponseCount = 0 @@ -24,6 +27,7 @@ internal class RetryingHttpClientTest { val okHttpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() httpClient = object : HttpClient { + override fun execute( request: HttpRequest, requestOptions: RequestOptions, @@ -40,6 +44,7 @@ internal class RetryingHttpClientTest { private fun trackClose(response: HttpResponse): HttpResponse { openResponseCount++ return object : HttpResponse { + private var isClosed = false override fun statusCode(): Int = response.statusCode() @@ -66,7 +71,7 @@ internal class RetryingHttpClientTest { @ValueSource(booleans = [false, true]) fun execute(async: Boolean) { stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) - val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).build() + val retryingClient = retryingHttpClientBuilder().build() val response = retryingClient.execute( @@ -88,11 +93,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) ) val retryingClient = - RetryingHttpClient.builder() - .httpClient(httpClient) - .maxRetries(2) - .idempotencyHeader("X-Some-Header") - .build() + retryingHttpClientBuilder().maxRetries(2).idempotencyHeader("X-Some-Header").build() val response = retryingClient.execute( @@ -134,8 +135,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() + val retryingClient = retryingHttpClientBuilder().maxRetries(2).build() val response = retryingClient.execute( @@ -181,8 +181,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() + val retryingClient = retryingHttpClientBuilder().maxRetries(2).build() val response = retryingClient.execute( @@ -220,8 +219,7 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = - RetryingHttpClient.builder().httpClient(httpClient).maxRetries(1).build() + val retryingClient = retryingHttpClientBuilder().maxRetries(1).build() val response = retryingClient.execute( @@ -234,6 +232,20 @@ internal class RetryingHttpClientTest { assertNoResponseLeaks() } + private fun retryingHttpClientBuilder() = + RetryingHttpClient.builder() + .httpClient(httpClient) + // Use a no-op `Sleeper` to make the test fast. + .sleeper( + object : RetryingHttpClient.Sleeper { + + override fun sleep(duration: Duration) {} + + override fun sleepAsync(duration: Duration): CompletableFuture = + CompletableFuture.completedFuture(null) + } + ) + private fun HttpClient.execute(request: HttpRequest, async: Boolean): HttpResponse = if (async) executeAsync(request).get() else execute(request) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt index bdd645452..a928e8cfd 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt @@ -28,8 +28,10 @@ import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows +import org.junit.jupiter.api.parallel.ResourceLock @WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class ErrorHandlingTest { companion object { diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt index 120c2a73d..945c467d2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt @@ -18,8 +18,10 @@ import com.withorb.api.core.JsonValue import com.withorb.api.models.CustomerCreateParams import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import org.junit.jupiter.api.parallel.ResourceLock @WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class ServiceParamsTest { private lateinit var client: OrbClient From 31827acf060986c871832a7619f09dae7aab1640 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 20:19:10 +0000 Subject: [PATCH 04/18] docs: explain http client customization --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 3cde381be..f77c081e2 100644 --- a/README.md +++ b/README.md @@ -378,6 +378,42 @@ OrbClient client = OrbOkHttpClient.builder() .build(); ``` +### Custom HTTP client + +The SDK consists of three artifacts: + +- `orb-java-core` + - Contains core SDK logic + - Does not depend on [OkHttp](https://square.github.io/okhttp) + - Exposes [`OrbClient`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt), [`OrbClientAsync`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt), [`OrbClientImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt), and [`OrbClientAsyncImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt), all of which can work with any HTTP client +- `orb-java-client-okhttp` + - Depends on [OkHttp](https://square.github.io/okhttp) + - Exposes [`OrbOkHttpClient`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt) and [`OrbOkHttpClientAsync`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt), which provide a way to construct [`OrbClientImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt) and [`OrbClientAsyncImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt), respectively, using OkHttp +- `orb-java` + - Depends on and exposes the APIs of both `orb-java-core` and `orb-java-client-okhttp` + - Does not have its own logic + +This structure allows replacing the SDK's default HTTP client without pulling in unnecessary dependencies. + +#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html) + +> [!TIP] +> Try the available [network options](#network-options) before replacing the default client. + +To use a customized `OkHttpClient`: + +1. Replace your [`orb-java` dependency](#installation) with `orb-java-core` +2. Copy `orb-java-client-okhttp`'s [`OkHttpClient`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt) class into your code and customize it +3. Construct [`OrbClientImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt) or [`OrbClientAsyncImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt), similarly to [`OrbOkHttpClient`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt) or [`OrbOkHttpClientAsync`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt), using your customized client + +### Completely custom HTTP client + +To use a completely custom HTTP client: + +1. Replace your [`orb-java` dependency](#installation) with `orb-java-core` +2. Write a class that implements the [`HttpClient`](orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpClient.kt) interface +3. Construct [`OrbClientImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt) or [`OrbClientAsyncImpl`](orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt), similarly to [`OrbOkHttpClient`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt) or [`OrbOkHttpClientAsync`](orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt), using your new client class + ## Undocumented API functionality The SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API. From 7db8db63862be728dc201e36aa3ff164307c5e4e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 21:13:13 +0000 Subject: [PATCH 05/18] chore(internal): codegen related update --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebbaa260b..9051fdd28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: @@ -30,6 +31,7 @@ jobs: - name: Run lints run: ./scripts/lint test: + timeout-minutes: 10 name: test runs-on: ubuntu-latest steps: From ddcc77e1835fe8ec200fbfeb5d0427ef19fb6d25 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:07:45 +0000 Subject: [PATCH 06/18] chore(ci): run on more branches and use depot runners --- .github/workflows/ci.yml | 17 +++++++++-------- .github/workflows/publish-sonatype.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9051fdd28..145d33aba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,19 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 + steps: - uses: actions/checkout@v4 @@ -33,7 +34,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 96822978e..00567513e 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -11,7 +11,7 @@ on: jobs: publish: name: publish - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index ff15a529a..3f5a1a678 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 if: github.repository == 'orbcorp/orb-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: From 68dcdd85f1eac797fae1136e383afae1ad5c0e28 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 20:09:12 +0000 Subject: [PATCH 07/18] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-sonatype.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 145d33aba..bdf8dab87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/orb-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -34,7 +34,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/orb-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 00567513e..96822978e 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -11,7 +11,7 @@ on: jobs: publish: name: publish - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 3f5a1a678..ff15a529a 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest if: github.repository == 'orbcorp/orb-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: From 7f2fb1063cd794a4c46fb88203944d4262a0a1db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 22:11:38 +0000 Subject: [PATCH 08/18] chore(internal): java 17 -> 21 on ci --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdf8dab87..d76a3e434 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: distribution: temurin java-version: | 8 - 17 + 21 cache: gradle - name: Set up Gradle @@ -44,7 +44,7 @@ jobs: distribution: temurin java-version: | 8 - 17 + 21 cache: gradle - name: Set up Gradle From 2b4abdff056e4bd158c6a2bc605c4ba09e4760d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 00:37:07 +0000 Subject: [PATCH 09/18] chore(internal): update java toolchain --- buildSrc/src/main/kotlin/orb.java.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/orb.java.gradle.kts b/buildSrc/src/main/kotlin/orb.java.gradle.kts index e39d9ac6c..dfbacb86e 100644 --- a/buildSrc/src/main/kotlin/orb.java.gradle.kts +++ b/buildSrc/src/main/kotlin/orb.java.gradle.kts @@ -21,7 +21,7 @@ configure { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } sourceCompatibility = JavaVersion.VERSION_1_8 From b085373fc56676f510a0b0900e8cecd2af633313 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 18:18:59 +0000 Subject: [PATCH 10/18] chore(internal): remove flaky `-Xbackend-threads=0` option --- buildSrc/src/main/kotlin/orb.kotlin.gradle.kts | 2 -- 1 file changed, 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts index ba40275a9..2d4a5c55c 100644 --- a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts @@ -19,8 +19,6 @@ kotlin { // Suppress deprecation warnings because we may still reference and test deprecated members. // TODO: Replace with `-Xsuppress-warning=DEPRECATION` once we use Kotlin compiler 2.1.0+. "-nowarn", - // Use as many threads as there are CPU cores on the machine for compilation. - "-Xbackend-threads=0", ) jvmTarget.set(JvmTarget.JVM_1_8) languageVersion.set(KotlinVersion.KOTLIN_1_9) From 9df208bf6cf18c90cc09bf1f3eba9ba1e5b4c767 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 21:17:41 +0000 Subject: [PATCH 11/18] chore(internal): codegen related update --- .../withorb/api/models/CouponCreateParams.kt | 386 +- .../api/models/CustomerCreateParams.kt | 391 +- ...editLedgerCreateEntryByExternalIdParams.kt | 1026 +- ...itLedgerCreateEntryByExternalIdResponse.kt | 1254 +- .../CustomerCreditLedgerCreateEntryParams.kt | 1026 +- ...CustomerCreditLedgerCreateEntryResponse.kt | 1254 +- ...merCreditLedgerListByExternalIdResponse.kt | 1254 +- .../CustomerCreditLedgerListResponse.kt | 1254 +- .../CustomerUpdateByExternalIdParams.kt | 393 +- .../api/models/CustomerUpdateParams.kt | 391 +- .../kotlin/com/withorb/api/models/Invoice.kt | 1512 +- .../models/InvoiceFetchUpcomingResponse.kt | 1512 +- .../models/InvoiceLineItemCreateResponse.kt | 1467 +- .../kotlin/com/withorb/api/models/Plan.kt | 942 +- .../withorb/api/models/PlanCreateParams.kt | 5010 ++----- .../kotlin/com/withorb/api/models/Price.kt | 5370 ++----- .../withorb/api/models/PriceCreateParams.kt | 5572 ++------ .../com/withorb/api/models/Subscription.kt | 1545 +- .../api/models/SubscriptionCancelResponse.kt | 1545 +- .../models/SubscriptionChangeApplyResponse.kt | 1555 +- .../SubscriptionChangeCancelResponse.kt | 1555 +- .../SubscriptionChangeRetrieveResponse.kt | 1555 +- .../api/models/SubscriptionCreateParams.kt | 11746 +++------------- .../api/models/SubscriptionCreateResponse.kt | 1545 +- .../SubscriptionPriceIntervalsParams.kt | 6865 ++------- .../SubscriptionPriceIntervalsResponse.kt | 1545 +- .../SubscriptionSchedulePlanChangeParams.kt | 11746 +++------------- .../SubscriptionSchedulePlanChangeResponse.kt | 1545 +- .../SubscriptionTriggerPhaseResponse.kt | 1545 +- ...scriptionUnscheduleCancellationResponse.kt | 1545 +- ...scheduleFixedFeeQuantityUpdatesResponse.kt | 1545 +- ...ionUnschedulePendingPlanChangesResponse.kt | 1545 +- ...scriptionUpdateFixedFeeQuantityResponse.kt | 1545 +- .../models/SubscriptionUpdateTrialResponse.kt | 1545 +- .../api/models/CouponCreateParamsTest.kt | 8 - ...ustomerCostListByExternalIdResponseTest.kt | 3 - .../models/CustomerCostListResponseTest.kt | 3 - .../api/models/CustomerCreateParamsTest.kt | 14 - ...LedgerCreateEntryByExternalIdParamsTest.kt | 24 - ...dgerCreateEntryByExternalIdResponseTest.kt | 71 - ...stomerCreditLedgerCreateEntryParamsTest.kt | 24 - ...omerCreditLedgerCreateEntryResponseTest.kt | 51 - ...tLedgerListByExternalIdPageResponseTest.kt | 15 - ...reditLedgerListByExternalIdResponseTest.kt | 59 - ...ustomerCreditLedgerListPageResponseTest.kt | 12 - .../CustomerCreditLedgerListResponseTest.kt | 44 - .../CustomerUpdateByExternalIdParamsTest.kt | 17 - .../api/models/CustomerUpdateParamsTest.kt | 14 - .../InvoiceFetchUpcomingResponseTest.kt | 38 - .../InvoiceLineItemCreateResponseTest.kt | 27 - .../api/models/InvoiceListPageResponseTest.kt | 31 - .../com/withorb/api/models/InvoiceTest.kt | 21 - .../api/models/PlanCreateParamsTest.kt | 5 - .../api/models/PlanListPageResponseTest.kt | 15 - .../kotlin/com/withorb/api/models/PlanTest.kt | 15 - .../api/models/PriceCreateParamsTest.kt | 5 - .../api/models/PriceListPageResponseTest.kt | 3 - .../com/withorb/api/models/PriceTest.kt | 81 - .../models/SubscriptionCancelResponseTest.kt | 121 - .../SubscriptionChangeApplyResponseTest.kt | 141 - .../SubscriptionChangeCancelResponseTest.kt | 141 - .../SubscriptionChangeRetrieveResponseTest.kt | 141 - .../models/SubscriptionCreateParamsTest.kt | 67 - .../models/SubscriptionCreateResponseTest.kt | 121 - .../SubscriptionFetchCostsResponseTest.kt | 3 - .../SubscriptionPriceIntervalsParamsTest.kt | 33 - .../SubscriptionPriceIntervalsResponseTest.kt | 124 - ...ubscriptionSchedulePlanChangeParamsTest.kt | 73 - ...scriptionSchedulePlanChangeResponseTest.kt | 126 - .../withorb/api/models/SubscriptionTest.kt | 45 - .../SubscriptionTriggerPhaseResponseTest.kt | 121 - ...ptionUnscheduleCancellationResponseTest.kt | 127 - ...duleFixedFeeQuantityUpdatesResponseTest.kt | 130 - ...nschedulePendingPlanChangesResponseTest.kt | 129 - ...ptionUpdateFixedFeeQuantityResponseTest.kt | 127 - .../SubscriptionUpdateTrialResponseTest.kt | 121 - .../withorb/api/models/SubscriptionsTest.kt | 53 - .../withorb/api/services/ErrorHandlingTest.kt | 45 - .../withorb/api/services/ServiceParamsTest.kt | 5 - .../async/CustomerServiceAsyncTest.kt | 16 - .../services/async/PlanServiceAsyncTest.kt | 1 - .../services/async/PriceServiceAsyncTest.kt | 1 - .../async/SubscriptionServiceAsyncTest.kt | 62 - .../credits/LedgerServiceAsyncTest.kt | 12 - .../services/blocking/CustomerServiceTest.kt | 16 - .../api/services/blocking/PlanServiceTest.kt | 1 - .../api/services/blocking/PriceServiceTest.kt | 1 - .../blocking/SubscriptionServiceTest.kt | 62 - .../customers/credits/LedgerServiceTest.kt | 12 - 89 files changed, 13751 insertions(+), 71058 deletions(-) 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 90f957174..87db2d797 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 @@ -15,7 +15,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer -import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing @@ -173,7 +172,6 @@ private constructor( * Alias for calling [discount] with the following: * ```java * Discount.NewCouponPercentageDiscount.builder() - * .discountType(CouponCreateParams.Discount.NewCouponPercentageDiscount.DiscountType.PERCENTAGE) * .percentageDiscount(percentageDiscount) * .build() * ``` @@ -191,7 +189,6 @@ private constructor( * Alias for calling [discount] with the following: * ```java * Discount.NewCouponAmountDiscount.builder() - * .discountType(CouponCreateParams.Discount.NewCouponAmountDiscount.DiscountType.AMOUNT) * .amountDiscount(amountDiscount) * .build() * ``` @@ -576,7 +573,6 @@ private constructor( * Alias for calling [discount] with the following: * ```java * Discount.NewCouponPercentageDiscount.builder() - * .discountType(CouponCreateParams.Discount.NewCouponPercentageDiscount.DiscountType.PERCENTAGE) * .percentageDiscount(percentageDiscount) * .build() * ``` @@ -584,10 +580,6 @@ private constructor( fun newCouponPercentageDiscount(percentageDiscount: Double) = discount( Discount.NewCouponPercentageDiscount.builder() - .discountType( - CouponCreateParams.Discount.NewCouponPercentageDiscount.DiscountType - .PERCENTAGE - ) .percentageDiscount(percentageDiscount) .build() ) @@ -600,7 +592,6 @@ private constructor( * Alias for calling [discount] with the following: * ```java * Discount.NewCouponAmountDiscount.builder() - * .discountType(CouponCreateParams.Discount.NewCouponAmountDiscount.DiscountType.AMOUNT) * .amountDiscount(amountDiscount) * .build() * ``` @@ -608,9 +599,6 @@ private constructor( fun newCouponAmountDiscount(amountDiscount: String) = discount( Discount.NewCouponAmountDiscount.builder() - .discountType( - CouponCreateParams.Discount.NewCouponAmountDiscount.DiscountType.AMOUNT - ) .amountDiscount(amountDiscount) .build() ) @@ -968,7 +956,7 @@ private constructor( class NewCouponPercentageDiscount private constructor( - private val discountType: JsonField, + private val discountType: JsonValue, private val percentageDiscount: JsonField, private val additionalProperties: MutableMap, ) { @@ -977,18 +965,24 @@ private constructor( private constructor( @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing percentageDiscount: JsonField = JsonMissing.of(), ) : this(discountType, percentageDiscount, mutableMapOf()) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -997,16 +991,6 @@ private constructor( */ fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [percentageDiscount]. * @@ -1037,7 +1021,6 @@ private constructor( * * The following fields are required: * ```java - * .discountType() * .percentageDiscount() * ``` */ @@ -1047,7 +1030,7 @@ private constructor( /** A builder for [NewCouponPercentageDiscount]. */ class Builder internal constructor() { - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var percentageDiscount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1060,17 +1043,19 @@ private constructor( newCouponPercentageDiscount.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -1117,7 +1102,6 @@ private constructor( * * The following fields are required: * ```java - * .discountType() * .percentageDiscount() * ``` * @@ -1125,7 +1109,7 @@ private constructor( */ fun build(): NewCouponPercentageDiscount = NewCouponPercentageDiscount( - checkRequired("discountType", discountType), + discountType, checkRequired("percentageDiscount", percentageDiscount), additionalProperties.toMutableMap(), ) @@ -1138,7 +1122,11 @@ private constructor( return@apply } - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } percentageDiscount() validated = true } @@ -1159,136 +1147,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (percentageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1310,7 +1171,7 @@ private constructor( class NewCouponAmountDiscount private constructor( private val amountDiscount: JsonField, - private val discountType: JsonField, + private val discountType: JsonValue, private val additionalProperties: MutableMap, ) { @@ -1321,7 +1182,7 @@ private constructor( amountDiscount: JsonField = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), ) : this(amountDiscount, discountType, mutableMapOf()) /** @@ -1332,11 +1193,17 @@ private constructor( fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * Returns the raw JSON value of [amountDiscount]. @@ -1348,16 +1215,6 @@ private constructor( @ExcludeMissing fun _amountDiscount(): JsonField = amountDiscount - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1379,7 +1236,6 @@ private constructor( * The following fields are required: * ```java * .amountDiscount() - * .discountType() * ``` */ @JvmStatic fun builder() = Builder() @@ -1389,7 +1245,7 @@ private constructor( class Builder internal constructor() { private var amountDiscount: JsonField? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1414,17 +1270,19 @@ private constructor( this.amountDiscount = amountDiscount } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -1458,7 +1316,6 @@ private constructor( * The following fields are required: * ```java * .amountDiscount() - * .discountType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -1466,7 +1323,7 @@ private constructor( fun build(): NewCouponAmountDiscount = NewCouponAmountDiscount( checkRequired("amountDiscount", amountDiscount), - checkRequired("discountType", discountType), + discountType, additionalProperties.toMutableMap(), ) } @@ -1479,7 +1336,11 @@ private constructor( } amountDiscount() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } validated = true } @@ -1500,134 +1361,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amountDiscount.asKnown().isPresent) 1 else 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) - - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } override fun equals(other: Any?): Boolean { if (this === other) { 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 c6d81bffc..ba80d01ad 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 @@ -833,7 +833,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewAvalaraTaxConfiguration.builder() - * .taxProvider(CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider.AVALARA) * .taxExempt(taxExempt) * .build() * ``` @@ -851,7 +850,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewTaxJarConfiguration.builder() - * .taxProvider(CustomerCreateParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider.TAXJAR) * .taxExempt(taxExempt) * .build() * ``` @@ -2081,7 +2079,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewAvalaraTaxConfiguration.builder() - * .taxProvider(CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider.AVALARA) * .taxExempt(taxExempt) * .build() * ``` @@ -2089,11 +2086,6 @@ private constructor( fun newAvalaraTaxConfiguration(taxExempt: Boolean) = taxConfiguration( TaxConfiguration.NewAvalaraTaxConfiguration.builder() - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExempt(taxExempt) .build() ) @@ -2108,20 +2100,13 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewTaxJarConfiguration.builder() - * .taxProvider(CustomerCreateParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider.TAXJAR) * .taxExempt(taxExempt) * .build() * ``` */ fun newTaxJarTaxConfiguration(taxExempt: Boolean) = taxConfiguration( - TaxConfiguration.NewTaxJarConfiguration.builder() - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider - .TAXJAR - ) - .taxExempt(taxExempt) - .build() + TaxConfiguration.NewTaxJarConfiguration.builder().taxExempt(taxExempt).build() ) /** @@ -4283,7 +4268,7 @@ private constructor( class NewAvalaraTaxConfiguration private constructor( private val taxExempt: JsonField, - private val taxProvider: JsonField, + private val taxProvider: JsonValue, private val taxExemptionCode: JsonField, private val additionalProperties: MutableMap, ) { @@ -4295,7 +4280,7 @@ private constructor( taxExempt: JsonField = JsonMissing.of(), @JsonProperty("tax_provider") @ExcludeMissing - taxProvider: JsonField = JsonMissing.of(), + taxProvider: JsonValue = JsonMissing.of(), @JsonProperty("tax_exemption_code") @ExcludeMissing taxExemptionCode: JsonField = JsonMissing.of(), @@ -4309,11 +4294,17 @@ private constructor( fun taxExempt(): Boolean = taxExempt.getRequired("tax_exempt") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("avalara") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun taxProvider(): TaxProvider = taxProvider.getRequired("tax_provider") + @JsonProperty("tax_provider") + @ExcludeMissing + fun _taxProvider(): JsonValue = taxProvider /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -4332,16 +4323,6 @@ private constructor( @ExcludeMissing fun _taxExempt(): JsonField = taxExempt - /** - * Returns the raw JSON value of [taxProvider]. - * - * Unlike [taxProvider], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tax_provider") - @ExcludeMissing - fun _taxProvider(): JsonField = taxProvider - /** * Returns the raw JSON value of [taxExemptionCode]. * @@ -4373,7 +4354,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` */ @JvmStatic fun builder() = Builder() @@ -4383,7 +4363,7 @@ private constructor( class Builder internal constructor() { private var taxExempt: JsonField? = null - private var taxProvider: JsonField? = null + private var taxProvider: JsonValue = JsonValue.from("avalara") private var taxExemptionCode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -4407,18 +4387,19 @@ private constructor( */ fun taxExempt(taxExempt: JsonField) = apply { this.taxExempt = taxExempt } - fun taxProvider(taxProvider: TaxProvider) = taxProvider(JsonField.of(taxProvider)) - /** - * Sets [Builder.taxProvider] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.taxProvider] with a well-typed [TaxProvider] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("avalara") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun taxProvider(taxProvider: JsonField) = apply { - this.taxProvider = taxProvider - } + fun taxProvider(taxProvider: JsonValue) = apply { this.taxProvider = taxProvider } fun taxExemptionCode(taxExemptionCode: String?) = taxExemptionCode(JsonField.ofNullable(taxExemptionCode)) @@ -4471,7 +4452,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4479,7 +4459,7 @@ private constructor( fun build(): NewAvalaraTaxConfiguration = NewAvalaraTaxConfiguration( checkRequired("taxExempt", taxExempt), - checkRequired("taxProvider", taxProvider), + taxProvider, taxExemptionCode, additionalProperties.toMutableMap(), ) @@ -4493,7 +4473,11 @@ private constructor( } taxExempt() - taxProvider().validate() + _taxProvider().let { + if (it != JsonValue.from("avalara")) { + throw OrbInvalidDataException("'taxProvider' is invalid, received $it") + } + } taxExemptionCode() validated = true } @@ -4515,135 +4499,9 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (taxExempt.asKnown().isPresent) 1 else 0) + - (taxProvider.asKnown().getOrNull()?.validity() ?: 0) + + taxProvider.let { if (it == JsonValue.from("avalara")) 1 else 0 } + (if (taxExemptionCode.asKnown().isPresent) 1 else 0) - class TaxProvider - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AVALARA = of("avalara") - - @JvmStatic fun of(value: String) = TaxProvider(JsonField.of(value)) - } - - /** An enum containing [TaxProvider]'s known values. */ - enum class Known { - AVALARA - } - - /** - * An enum containing [TaxProvider]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TaxProvider] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AVALARA, - /** - * An enum member indicating that [TaxProvider] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AVALARA -> Value.AVALARA - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AVALARA -> Known.AVALARA - else -> throw OrbInvalidDataException("Unknown TaxProvider: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TaxProvider = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TaxProvider && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4665,7 +4523,7 @@ private constructor( class NewTaxJarConfiguration private constructor( private val taxExempt: JsonField, - private val taxProvider: JsonField, + private val taxProvider: JsonValue, private val additionalProperties: MutableMap, ) { @@ -4676,7 +4534,7 @@ private constructor( taxExempt: JsonField = JsonMissing.of(), @JsonProperty("tax_provider") @ExcludeMissing - taxProvider: JsonField = JsonMissing.of(), + taxProvider: JsonValue = JsonMissing.of(), ) : this(taxExempt, taxProvider, mutableMapOf()) /** @@ -4687,11 +4545,17 @@ private constructor( fun taxExempt(): Boolean = taxExempt.getRequired("tax_exempt") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("taxjar") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun taxProvider(): TaxProvider = taxProvider.getRequired("tax_provider") + @JsonProperty("tax_provider") + @ExcludeMissing + fun _taxProvider(): JsonValue = taxProvider /** * Returns the raw JSON value of [taxExempt]. @@ -4703,16 +4567,6 @@ private constructor( @ExcludeMissing fun _taxExempt(): JsonField = taxExempt - /** - * Returns the raw JSON value of [taxProvider]. - * - * Unlike [taxProvider], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tax_provider") - @ExcludeMissing - fun _taxProvider(): JsonField = taxProvider - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -4734,7 +4588,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` */ @JvmStatic fun builder() = Builder() @@ -4744,7 +4597,7 @@ private constructor( class Builder internal constructor() { private var taxExempt: JsonField? = null - private var taxProvider: JsonField? = null + private var taxProvider: JsonValue = JsonValue.from("taxjar") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -4766,18 +4619,19 @@ private constructor( */ fun taxExempt(taxExempt: JsonField) = apply { this.taxExempt = taxExempt } - fun taxProvider(taxProvider: TaxProvider) = taxProvider(JsonField.of(taxProvider)) - /** - * Sets [Builder.taxProvider] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.taxProvider] with a well-typed [TaxProvider] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("taxjar") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun taxProvider(taxProvider: JsonField) = apply { - this.taxProvider = taxProvider - } + fun taxProvider(taxProvider: JsonValue) = apply { this.taxProvider = taxProvider } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4809,7 +4663,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4817,7 +4670,7 @@ private constructor( fun build(): NewTaxJarConfiguration = NewTaxJarConfiguration( checkRequired("taxExempt", taxExempt), - checkRequired("taxProvider", taxProvider), + taxProvider, additionalProperties.toMutableMap(), ) } @@ -4830,7 +4683,11 @@ private constructor( } taxExempt() - taxProvider().validate() + _taxProvider().let { + if (it != JsonValue.from("taxjar")) { + throw OrbInvalidDataException("'taxProvider' is invalid, received $it") + } + } validated = true } @@ -4851,133 +4708,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (taxExempt.asKnown().isPresent) 1 else 0) + - (taxProvider.asKnown().getOrNull()?.validity() ?: 0) - - class TaxProvider - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TAXJAR = of("taxjar") - - @JvmStatic fun of(value: String) = TaxProvider(JsonField.of(value)) - } - - /** An enum containing [TaxProvider]'s known values. */ - enum class Known { - TAXJAR - } - - /** - * An enum containing [TaxProvider]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TaxProvider] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TAXJAR, - /** - * An enum member indicating that [TaxProvider] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TAXJAR -> Value.TAXJAR - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TAXJAR -> Known.TAXJAR - else -> throw OrbInvalidDataException("Unknown TaxProvider: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TaxProvider = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TaxProvider && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + taxProvider.let { if (it == JsonValue.from("taxjar")) 1 else 0 } override fun equals(other: Any?): Boolean { if (this === other) { 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 77e0bcc2a..9b3b099ad 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 @@ -215,23 +215,12 @@ private constructor( * Alias for calling [body] with the following: * ```java * Body.AddIncrementCreditLedgerEntryRequestParams.builder() - * .entryType(CustomerCreditLedgerCreateEntryByExternalIdParams.Body.AddIncrementCreditLedgerEntryRequestParams.EntryType.INCREMENT) * .amount(amount) * .build() * ``` */ fun addIncrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body( - Body.AddIncrementCreditLedgerEntryRequestParams.builder() - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) - .amount(amount) - .build() - ) + body(Body.AddIncrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) /** * Alias for calling [body] with @@ -251,23 +240,12 @@ private constructor( * Alias for calling [body] with the following: * ```java * Body.AddDecrementCreditLedgerEntryRequestParams.builder() - * .entryType(CustomerCreditLedgerCreateEntryByExternalIdParams.Body.AddDecrementCreditLedgerEntryRequestParams.EntryType.DECREMENT) * .amount(amount) * .build() * ``` */ fun addDecrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body( - Body.AddDecrementCreditLedgerEntryRequestParams.builder() - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddDecrementCreditLedgerEntryRequestParams - .EntryType - .DECREMENT - ) - .amount(amount) - .build() - ) + body(Body.AddDecrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) /** * Alias for calling [body] with @@ -850,7 +828,7 @@ private constructor( class AddIncrementCreditLedgerEntryRequestParams private constructor( private val amount: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val effectiveDate: JsonField, @@ -866,9 +844,7 @@ private constructor( @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -914,11 +890,15 @@ private constructor( fun amount(): Double = amount.getRequired("amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("increment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -995,16 +975,6 @@ private constructor( */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -1094,7 +1064,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -1104,7 +1073,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("increment") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() @@ -1148,18 +1117,19 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("increment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -1342,7 +1312,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -1350,7 +1319,7 @@ private constructor( fun build(): AddIncrementCreditLedgerEntryRequestParams = AddIncrementCreditLedgerEntryRequestParams( checkRequired("amount", amount), - checkRequired("entryType", entryType), + entryType, currency, description, effectiveDate, @@ -1370,7 +1339,11 @@ private constructor( } amount() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("increment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() effectiveDate() @@ -1398,7 +1371,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("increment")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (if (effectiveDate.asKnown().isPresent) 1 else 0) + @@ -1407,131 +1380,6 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val INCREMENT = of("increment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - INCREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INCREMENT -> Value.INCREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - INCREMENT -> Known.INCREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * 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 @@ -1981,7 +1829,7 @@ private constructor( class AddDecrementCreditLedgerEntryRequestParams private constructor( private val amount: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val metadata: JsonField, @@ -1993,9 +1841,7 @@ private constructor( @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -2018,11 +1864,15 @@ private constructor( fun amount(): Double = amount.getRequired("amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -2060,16 +1910,6 @@ private constructor( */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -2119,7 +1959,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -2129,7 +1968,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("decrement") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -2165,18 +2004,19 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -2268,7 +2108,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -2276,7 +2115,7 @@ private constructor( fun build(): AddDecrementCreditLedgerEntryRequestParams = AddDecrementCreditLedgerEntryRequestParams( checkRequired("amount", amount), - checkRequired("entryType", entryType), + entryType, currency, description, metadata, @@ -2292,7 +2131,11 @@ private constructor( } amount() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("decrement")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() metadata().ifPresent { it.validate() } @@ -2316,186 +2159,61 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("decrement")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun toBuilder() = Builder().from(this) companion object { - @JvmField val DECREMENT = of("decrement") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECREMENT -> Value.DECREMENT - else -> Value._UNKNOWN + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DECREMENT -> Known.DECREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - private var validated: Boolean = false + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - class Metadata - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Metadata]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Metadata]. */ - class Builder internal constructor() { - - 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 removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } fun removeAllAdditionalProperties(keys: Set) = apply { @@ -2577,7 +2295,7 @@ private constructor( class AddExpirationChangeCreditLedgerEntryRequestParams private constructor( - private val entryType: JsonField, + private val entryType: JsonValue, private val expiryDate: JsonField, private val targetExpiryDate: JsonField, private val amount: JsonField, @@ -2590,9 +2308,7 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("expiry_date") @ExcludeMissing expiryDate: JsonField = JsonMissing.of(), @@ -2627,11 +2343,15 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * An ISO 8601 format date that identifies the origination credit block to expire @@ -2698,16 +2418,6 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [expiryDate]. * @@ -2790,7 +2500,6 @@ private constructor( * * The following fields are required: * ```java - * .entryType() * .expiryDate() * .targetExpiryDate() * ``` @@ -2801,7 +2510,7 @@ private constructor( /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ class Builder internal constructor() { - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("expiration_change") private var expiryDate: JsonField? = null private var targetExpiryDate: JsonField? = null private var amount: JsonField = JsonMissing.of() @@ -2830,18 +2539,19 @@ private constructor( .toMutableMap() } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * An ISO 8601 format date that identifies the origination credit block to expire @@ -3016,7 +2726,6 @@ private constructor( * * The following fields are required: * ```java - * .entryType() * .expiryDate() * .targetExpiryDate() * ``` @@ -3025,7 +2734,7 @@ private constructor( */ fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = AddExpirationChangeCreditLedgerEntryRequestParams( - checkRequired("entryType", entryType), + entryType, checkRequired("expiryDate", expiryDate), checkRequired("targetExpiryDate", targetExpiryDate), amount, @@ -3044,7 +2753,11 @@ private constructor( return@apply } - entryType().validate() + _entryType().let { + if (it != JsonValue.from("expiration_change")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } expiryDate() targetExpiryDate() amount() @@ -3071,7 +2784,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + (if (expiryDate.asKnown().isPresent) 1 else 0) + (if (targetExpiryDate.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + @@ -3080,131 +2793,6 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EXPIRATION_CHANGE = of("expiration_change") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EXPIRATION_CHANGE, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EXPIRATION_CHANGE -> Value.EXPIRATION_CHANGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by @@ -3338,7 +2926,7 @@ private constructor( private constructor( private val amount: JsonField, private val blockId: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val metadata: JsonField, @@ -3354,9 +2942,7 @@ private constructor( @JsonProperty("block_id") @ExcludeMissing blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -3400,11 +2986,15 @@ private constructor( fun blockId(): String = blockId.getRequired("block_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("void") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -3457,16 +3047,6 @@ private constructor( */ @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -3527,7 +3107,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -3538,7 +3117,7 @@ private constructor( private var amount: JsonField? = null private var blockId: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -3587,18 +3166,19 @@ private constructor( */ fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -3710,7 +3290,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -3719,7 +3298,7 @@ private constructor( AddVoidCreditLedgerEntryRequestParams( checkRequired("amount", amount), checkRequired("blockId", blockId), - checkRequired("entryType", entryType), + entryType, currency, description, metadata, @@ -3737,7 +3316,11 @@ private constructor( amount() blockId() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() metadata().ifPresent { it.validate() } @@ -3763,137 +3346,12 @@ private constructor( internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + (if (blockId.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (voidReason.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by @@ -4154,7 +3612,7 @@ private constructor( private constructor( private val amount: JsonField, private val blockId: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val metadata: JsonField, @@ -4169,9 +3627,7 @@ private constructor( @JsonProperty("block_id") @ExcludeMissing blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -4203,11 +3659,15 @@ private constructor( fun blockId(): String = blockId.getRequired("block_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -4252,16 +3712,6 @@ private constructor( */ @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -4312,7 +3762,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -4323,7 +3772,7 @@ private constructor( private var amount: JsonField? = null private var blockId: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("amendment") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -4372,18 +3821,19 @@ private constructor( */ fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -4476,7 +3926,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4485,7 +3934,7 @@ private constructor( AddAmendmentCreditLedgerEntryRequestParams( checkRequired("amount", amount), checkRequired("blockId", blockId), - checkRequired("entryType", entryType), + entryType, currency, description, metadata, @@ -4502,7 +3951,11 @@ private constructor( amount() blockId() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("amendment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() metadata().ifPresent { it.validate() } @@ -4527,136 +3980,11 @@ private constructor( internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + (if (blockId.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("amendment")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMENDMENT = of("amendment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMENDMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMENDMENT -> Value.AMENDMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMENDMENT -> Known.AMENDMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by 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 0f1b25f8f..aecbbd5bd 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 @@ -453,7 +453,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -485,9 +485,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -569,10 +567,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("increment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -671,15 +674,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -735,7 +729,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -756,7 +749,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("increment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -892,16 +885,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("increment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -982,7 +978,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -1001,7 +996,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -1025,7 +1020,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("increment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -1057,7 +1056,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("increment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -1656,129 +1655,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val INCREMENT = of("increment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - INCREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INCREMENT -> Value.INCREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - INCREMENT -> Known.INCREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -1917,7 +1793,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -1952,9 +1828,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -2044,10 +1918,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -2164,15 +2043,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -2249,7 +2119,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2270,7 +2139,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("decrement") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -2412,16 +2281,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -2544,7 +2416,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2563,7 +2434,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -2590,7 +2461,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("decrement")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -2625,7 +2500,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("decrement")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -3227,129 +3102,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DECREMENT = of("decrement") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECREMENT -> Value.DECREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DECREMENT -> Known.DECREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -3488,7 +3240,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -3521,9 +3273,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -3609,10 +3359,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -3718,15 +3473,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -3793,7 +3539,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -3815,7 +3560,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("expiration_change") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -3954,16 +3699,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -4065,7 +3813,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -4085,7 +3832,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -4110,7 +3857,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("expiration_change")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -4143,7 +3894,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -4743,129 +4494,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EXPIRATION_CHANGE = of("expiration_change") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EXPIRATION_CHANGE, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EXPIRATION_CHANGE -> Value.EXPIRATION_CHANGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -5004,7 +4632,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -5036,9 +4664,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -5120,10 +4746,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -5222,15 +4853,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -5287,7 +4909,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5308,7 +4929,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("credit_block_expiry") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -5445,16 +5066,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -5535,7 +5159,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5554,7 +5177,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -5578,7 +5201,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("credit_block_expiry")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -5610,7 +5237,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("credit_block_expiry")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -6209,129 +5836,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CREDIT_BLOCK_EXPIRY = of("credit_block_expiry") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - CREDIT_BLOCK_EXPIRY - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CREDIT_BLOCK_EXPIRY, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CREDIT_BLOCK_EXPIRY -> Value.CREDIT_BLOCK_EXPIRY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CREDIT_BLOCK_EXPIRY -> Known.CREDIT_BLOCK_EXPIRY - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -6470,7 +5974,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -6504,9 +6008,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -6596,10 +6098,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -6710,15 +6217,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -6792,7 +6290,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -6815,7 +6312,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -6955,16 +6452,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -7070,7 +6570,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -7091,7 +6590,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -7117,7 +6616,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -7151,7 +6654,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -7696,131 +7199,8 @@ private constructor( fun known(): Known = when (this) { COMMITTED -> Known.COMMITTED - PENDING -> Known.PENDING - else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + PENDING -> Known.PENDING + else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") } /** @@ -7837,7 +7217,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EntryType = apply { + fun validate(): EntryStatus = apply { if (validated) { return@apply } @@ -7867,7 +7247,7 @@ private constructor( return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -8013,7 +7393,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -8048,9 +7428,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -8144,10 +7522,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -8265,15 +7648,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -8357,7 +7731,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8381,7 +7754,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void_initiated") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -8523,16 +7896,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -8652,7 +8028,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8674,7 +8049,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -8701,7 +8076,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void_initiated")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -8736,7 +8115,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void_initiated")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -9338,129 +8717,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID_INITIATED = of("void_initiated") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID_INITIATED - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID_INITIATED, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID_INITIATED -> Value.VOID_INITIATED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID_INITIATED -> Known.VOID_INITIATED - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -9599,7 +8855,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -9631,9 +8887,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -9715,10 +8969,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -9817,15 +9076,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -9881,7 +9131,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -9902,7 +9151,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("amendment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -10038,16 +9287,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -10128,7 +9380,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -10147,7 +9398,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -10171,7 +9422,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("amendment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -10203,7 +9458,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("amendment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -10802,129 +10057,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMENDMENT = of("amendment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMENDMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMENDMENT -> Value.AMENDMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMENDMENT -> Known.AMENDMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the 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 5d118b319..3e4bf0127 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 @@ -210,23 +210,12 @@ private constructor( * Alias for calling [body] with the following: * ```java * Body.AddIncrementCreditLedgerEntryRequestParams.builder() - * .entryType(CustomerCreditLedgerCreateEntryParams.Body.AddIncrementCreditLedgerEntryRequestParams.EntryType.INCREMENT) * .amount(amount) * .build() * ``` */ fun addIncrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body( - Body.AddIncrementCreditLedgerEntryRequestParams.builder() - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) - .amount(amount) - .build() - ) + body(Body.AddIncrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) /** * Alias for calling [body] with @@ -246,23 +235,12 @@ private constructor( * Alias for calling [body] with the following: * ```java * Body.AddDecrementCreditLedgerEntryRequestParams.builder() - * .entryType(CustomerCreditLedgerCreateEntryParams.Body.AddDecrementCreditLedgerEntryRequestParams.EntryType.DECREMENT) * .amount(amount) * .build() * ``` */ fun addDecrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body( - Body.AddDecrementCreditLedgerEntryRequestParams.builder() - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddDecrementCreditLedgerEntryRequestParams - .EntryType - .DECREMENT - ) - .amount(amount) - .build() - ) + body(Body.AddDecrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) /** * Alias for calling [body] with @@ -845,7 +823,7 @@ private constructor( class AddIncrementCreditLedgerEntryRequestParams private constructor( private val amount: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val effectiveDate: JsonField, @@ -861,9 +839,7 @@ private constructor( @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -909,11 +885,15 @@ private constructor( fun amount(): Double = amount.getRequired("amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("increment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -990,16 +970,6 @@ private constructor( */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -1089,7 +1059,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -1099,7 +1068,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("increment") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() @@ -1143,18 +1112,19 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("increment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -1337,7 +1307,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -1345,7 +1314,7 @@ private constructor( fun build(): AddIncrementCreditLedgerEntryRequestParams = AddIncrementCreditLedgerEntryRequestParams( checkRequired("amount", amount), - checkRequired("entryType", entryType), + entryType, currency, description, effectiveDate, @@ -1365,7 +1334,11 @@ private constructor( } amount() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("increment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() effectiveDate() @@ -1393,7 +1366,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("increment")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (if (effectiveDate.asKnown().isPresent) 1 else 0) + @@ -1402,131 +1375,6 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val INCREMENT = of("increment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - INCREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INCREMENT -> Value.INCREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - INCREMENT -> Known.INCREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * 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 @@ -1976,7 +1824,7 @@ private constructor( class AddDecrementCreditLedgerEntryRequestParams private constructor( private val amount: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val metadata: JsonField, @@ -1988,9 +1836,7 @@ private constructor( @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -2013,11 +1859,15 @@ private constructor( fun amount(): Double = amount.getRequired("amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -2055,16 +1905,6 @@ private constructor( */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -2114,7 +1954,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -2124,7 +1963,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("decrement") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -2160,18 +1999,19 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -2263,7 +2103,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -2271,7 +2110,7 @@ private constructor( fun build(): AddDecrementCreditLedgerEntryRequestParams = AddDecrementCreditLedgerEntryRequestParams( checkRequired("amount", amount), - checkRequired("entryType", entryType), + entryType, currency, description, metadata, @@ -2287,7 +2126,11 @@ private constructor( } amount() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("decrement")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() metadata().ifPresent { it.validate() } @@ -2311,186 +2154,61 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("decrement")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun toBuilder() = Builder().from(this) companion object { - @JvmField val DECREMENT = of("decrement") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECREMENT -> Value.DECREMENT - else -> Value._UNKNOWN + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DECREMENT -> Known.DECREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - private var validated: Boolean = false + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - class Metadata - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Metadata]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Metadata]. */ - class Builder internal constructor() { - - 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 removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } fun removeAllAdditionalProperties(keys: Set) = apply { @@ -2572,7 +2290,7 @@ private constructor( class AddExpirationChangeCreditLedgerEntryRequestParams private constructor( - private val entryType: JsonField, + private val entryType: JsonValue, private val expiryDate: JsonField, private val targetExpiryDate: JsonField, private val amount: JsonField, @@ -2585,9 +2303,7 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("expiry_date") @ExcludeMissing expiryDate: JsonField = JsonMissing.of(), @@ -2622,11 +2338,15 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * An ISO 8601 format date that identifies the origination credit block to expire @@ -2693,16 +2413,6 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [expiryDate]. * @@ -2785,7 +2495,6 @@ private constructor( * * The following fields are required: * ```java - * .entryType() * .expiryDate() * .targetExpiryDate() * ``` @@ -2796,7 +2505,7 @@ private constructor( /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ class Builder internal constructor() { - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("expiration_change") private var expiryDate: JsonField? = null private var targetExpiryDate: JsonField? = null private var amount: JsonField = JsonMissing.of() @@ -2825,18 +2534,19 @@ private constructor( .toMutableMap() } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * An ISO 8601 format date that identifies the origination credit block to expire @@ -3011,7 +2721,6 @@ private constructor( * * The following fields are required: * ```java - * .entryType() * .expiryDate() * .targetExpiryDate() * ``` @@ -3020,7 +2729,7 @@ private constructor( */ fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = AddExpirationChangeCreditLedgerEntryRequestParams( - checkRequired("entryType", entryType), + entryType, checkRequired("expiryDate", expiryDate), checkRequired("targetExpiryDate", targetExpiryDate), amount, @@ -3039,7 +2748,11 @@ private constructor( return@apply } - entryType().validate() + _entryType().let { + if (it != JsonValue.from("expiration_change")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } expiryDate() targetExpiryDate() amount() @@ -3066,7 +2779,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + (if (expiryDate.asKnown().isPresent) 1 else 0) + (if (targetExpiryDate.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + @@ -3075,131 +2788,6 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EXPIRATION_CHANGE = of("expiration_change") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EXPIRATION_CHANGE, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EXPIRATION_CHANGE -> Value.EXPIRATION_CHANGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by @@ -3333,7 +2921,7 @@ private constructor( private constructor( private val amount: JsonField, private val blockId: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val metadata: JsonField, @@ -3349,9 +2937,7 @@ private constructor( @JsonProperty("block_id") @ExcludeMissing blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -3395,11 +2981,15 @@ private constructor( fun blockId(): String = blockId.getRequired("block_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("void") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -3452,16 +3042,6 @@ private constructor( */ @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -3522,7 +3102,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -3533,7 +3112,7 @@ private constructor( private var amount: JsonField? = null private var blockId: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -3582,18 +3161,19 @@ private constructor( */ fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -3705,7 +3285,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -3714,7 +3293,7 @@ private constructor( AddVoidCreditLedgerEntryRequestParams( checkRequired("amount", amount), checkRequired("blockId", blockId), - checkRequired("entryType", entryType), + entryType, currency, description, metadata, @@ -3732,7 +3311,11 @@ private constructor( amount() blockId() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() metadata().ifPresent { it.validate() } @@ -3758,137 +3341,12 @@ private constructor( internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + (if (blockId.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (voidReason.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by @@ -4149,7 +3607,7 @@ private constructor( private constructor( private val amount: JsonField, private val blockId: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val currency: JsonField, private val description: JsonField, private val metadata: JsonField, @@ -4164,9 +3622,7 @@ private constructor( @JsonProperty("block_id") @ExcludeMissing blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @@ -4198,11 +3654,15 @@ private constructor( fun blockId(): String = blockId.getRequired("block_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -4247,16 +3707,6 @@ private constructor( */ @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [currency]. * @@ -4307,7 +3757,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` */ @JvmStatic fun builder() = Builder() @@ -4318,7 +3767,7 @@ private constructor( private var amount: JsonField? = null private var blockId: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("amendment") private var currency: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -4367,18 +3816,19 @@ private constructor( */ fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entryType(entryType: JsonField) = apply { - this.entryType = entryType - } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a @@ -4471,7 +3921,6 @@ private constructor( * ```java * .amount() * .blockId() - * .entryType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4480,7 +3929,7 @@ private constructor( AddAmendmentCreditLedgerEntryRequestParams( checkRequired("amount", amount), checkRequired("blockId", blockId), - checkRequired("entryType", entryType), + entryType, currency, description, metadata, @@ -4497,7 +3946,11 @@ private constructor( amount() blockId() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("amendment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } currency() description() metadata().ifPresent { it.validate() } @@ -4522,136 +3975,11 @@ private constructor( internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + (if (blockId.asKnown().isPresent) 1 else 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("amendment")) 1 else 0 } + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMENDMENT = of("amendment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMENDMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMENDMENT -> Value.AMENDMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMENDMENT -> Known.AMENDMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by 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 72c2ad8e3..e722d0352 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 @@ -437,7 +437,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -469,9 +469,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -553,10 +551,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("increment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -655,15 +658,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -719,7 +713,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -740,7 +733,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("increment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -876,16 +869,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("increment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -966,7 +962,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -985,7 +980,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -1009,7 +1004,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("increment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -1041,7 +1040,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("increment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -1640,129 +1639,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val INCREMENT = of("increment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - INCREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INCREMENT -> Value.INCREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - INCREMENT -> Known.INCREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -1901,7 +1777,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -1936,9 +1812,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -2028,10 +1902,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -2148,15 +2027,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -2233,7 +2103,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2254,7 +2123,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("decrement") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -2396,16 +2265,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -2528,7 +2400,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2547,7 +2418,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -2574,7 +2445,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("decrement")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -2609,7 +2484,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("decrement")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -3211,129 +3086,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DECREMENT = of("decrement") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECREMENT -> Value.DECREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DECREMENT -> Known.DECREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -3472,7 +3224,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -3505,9 +3257,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -3593,10 +3343,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -3702,15 +3457,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -3777,7 +3523,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -3799,7 +3544,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("expiration_change") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -3938,16 +3683,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -4049,7 +3797,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -4069,7 +3816,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -4094,7 +3841,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("expiration_change")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -4127,7 +3878,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -4727,129 +4478,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EXPIRATION_CHANGE = of("expiration_change") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EXPIRATION_CHANGE, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EXPIRATION_CHANGE -> Value.EXPIRATION_CHANGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -4988,7 +4616,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -5020,9 +4648,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -5104,10 +4730,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -5206,15 +4837,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -5271,7 +4893,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5292,7 +4913,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("credit_block_expiry") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -5429,16 +5050,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -5519,7 +5143,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5538,7 +5161,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -5562,7 +5185,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("credit_block_expiry")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -5594,7 +5221,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("credit_block_expiry")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -6193,129 +5820,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CREDIT_BLOCK_EXPIRY = of("credit_block_expiry") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - CREDIT_BLOCK_EXPIRY - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CREDIT_BLOCK_EXPIRY, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CREDIT_BLOCK_EXPIRY -> Value.CREDIT_BLOCK_EXPIRY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CREDIT_BLOCK_EXPIRY -> Known.CREDIT_BLOCK_EXPIRY - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -6454,7 +5958,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -6488,9 +5992,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -6580,10 +6082,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -6694,15 +6201,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -6776,7 +6274,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -6799,7 +6296,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -6939,16 +6436,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -7054,7 +6554,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -7075,7 +6574,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -7101,7 +6600,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -7135,7 +6638,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -7680,131 +7183,8 @@ private constructor( fun known(): Known = when (this) { COMMITTED -> Known.COMMITTED - PENDING -> Known.PENDING - else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + PENDING -> Known.PENDING + else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") } /** @@ -7821,7 +7201,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EntryType = apply { + fun validate(): EntryStatus = apply { if (validated) { return@apply } @@ -7851,7 +7231,7 @@ private constructor( return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -7997,7 +7377,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -8032,9 +7412,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -8128,10 +7506,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -8249,15 +7632,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -8341,7 +7715,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8365,7 +7738,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void_initiated") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -8507,16 +7880,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -8636,7 +8012,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8658,7 +8033,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -8685,7 +8060,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void_initiated")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -8720,7 +8099,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void_initiated")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -9322,129 +8701,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID_INITIATED = of("void_initiated") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID_INITIATED - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID_INITIATED, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID_INITIATED -> Value.VOID_INITIATED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID_INITIATED -> Known.VOID_INITIATED - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -9583,7 +8839,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -9615,9 +8871,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -9699,10 +8953,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -9801,15 +9060,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -9865,7 +9115,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -9886,7 +9135,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("amendment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -10022,16 +9271,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -10112,7 +9364,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -10131,7 +9382,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -10155,7 +9406,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("amendment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -10187,7 +9442,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("amendment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -10786,129 +10041,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMENDMENT = of("amendment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMENDMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMENDMENT -> Value.AMENDMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMENDMENT -> Known.AMENDMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the 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 9ac44913d..6341893f9 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 @@ -451,7 +451,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -483,9 +483,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -567,10 +565,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("increment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -669,15 +672,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -733,7 +727,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -754,7 +747,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("increment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -890,16 +883,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("increment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -980,7 +976,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -999,7 +994,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -1023,7 +1018,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("increment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -1055,7 +1054,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("increment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -1654,129 +1653,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val INCREMENT = of("increment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - INCREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INCREMENT -> Value.INCREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - INCREMENT -> Known.INCREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -1915,7 +1791,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -1950,9 +1826,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -2042,10 +1916,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -2162,15 +2041,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -2247,7 +2117,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2268,7 +2137,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("decrement") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -2410,16 +2279,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -2542,7 +2414,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2561,7 +2432,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -2588,7 +2459,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("decrement")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -2623,7 +2498,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("decrement")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -3225,129 +3100,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DECREMENT = of("decrement") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECREMENT -> Value.DECREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DECREMENT -> Known.DECREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -3486,7 +3238,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -3519,9 +3271,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -3607,10 +3357,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -3716,15 +3471,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -3791,7 +3537,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -3813,7 +3558,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("expiration_change") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -3952,16 +3697,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -4063,7 +3811,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -4083,7 +3830,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -4108,7 +3855,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("expiration_change")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -4141,7 +3892,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -4741,129 +4492,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EXPIRATION_CHANGE = of("expiration_change") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EXPIRATION_CHANGE, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EXPIRATION_CHANGE -> Value.EXPIRATION_CHANGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -5002,7 +4630,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -5034,9 +4662,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -5118,10 +4744,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -5220,15 +4851,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -5285,7 +4907,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5306,7 +4927,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("credit_block_expiry") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -5443,16 +5064,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -5533,7 +5157,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5552,7 +5175,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -5576,7 +5199,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("credit_block_expiry")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -5608,7 +5235,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("credit_block_expiry")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -6207,129 +5834,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CREDIT_BLOCK_EXPIRY = of("credit_block_expiry") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - CREDIT_BLOCK_EXPIRY - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CREDIT_BLOCK_EXPIRY, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CREDIT_BLOCK_EXPIRY -> Value.CREDIT_BLOCK_EXPIRY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CREDIT_BLOCK_EXPIRY -> Known.CREDIT_BLOCK_EXPIRY - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -6468,7 +5972,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -6502,9 +6006,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -6594,10 +6096,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -6708,15 +6215,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -6790,7 +6288,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -6813,7 +6310,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -6953,16 +6450,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -7068,7 +6568,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -7089,7 +6588,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -7115,7 +6614,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -7149,7 +6652,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -7694,131 +7197,8 @@ private constructor( fun known(): Known = when (this) { COMMITTED -> Known.COMMITTED - PENDING -> Known.PENDING - else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + PENDING -> Known.PENDING + else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") } /** @@ -7835,7 +7215,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EntryType = apply { + fun validate(): EntryStatus = apply { if (validated) { return@apply } @@ -7865,7 +7245,7 @@ private constructor( return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -8011,7 +7391,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -8046,9 +7426,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -8142,10 +7520,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -8263,15 +7646,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -8355,7 +7729,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8379,7 +7752,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void_initiated") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -8521,16 +7894,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -8650,7 +8026,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8672,7 +8047,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -8699,7 +8074,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void_initiated")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -8734,7 +8113,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void_initiated")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -9336,129 +8715,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID_INITIATED = of("void_initiated") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID_INITIATED - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID_INITIATED, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID_INITIATED -> Value.VOID_INITIATED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID_INITIATED -> Known.VOID_INITIATED - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -9597,7 +8853,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -9629,9 +8885,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -9713,10 +8967,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -9815,15 +9074,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -9879,7 +9129,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -9900,7 +9149,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("amendment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -10036,16 +9285,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -10126,7 +9378,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -10145,7 +9396,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -10169,7 +9420,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("amendment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -10201,7 +9456,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("amendment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -10800,129 +10055,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMENDMENT = of("amendment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMENDMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMENDMENT -> Value.AMENDMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMENDMENT -> Known.AMENDMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the 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 4edf63c6b..7c5725808 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 @@ -420,7 +420,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -452,9 +452,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -536,10 +534,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("increment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -638,15 +641,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -702,7 +696,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -723,7 +716,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("increment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -859,16 +852,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("increment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -949,7 +945,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -968,7 +963,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -992,7 +987,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("increment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -1024,7 +1023,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("increment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -1623,129 +1622,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val INCREMENT = of("increment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - INCREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INCREMENT -> Value.INCREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - INCREMENT -> Known.INCREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -1884,7 +1760,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -1919,9 +1795,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -2011,10 +1885,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -2131,15 +2010,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -2216,7 +2086,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2237,7 +2106,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("decrement") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -2379,16 +2248,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("decrement") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -2511,7 +2383,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -2530,7 +2401,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -2557,7 +2428,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("decrement")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -2592,7 +2467,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("decrement")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -3194,129 +3069,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DECREMENT = of("decrement") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECREMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECREMENT -> Value.DECREMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DECREMENT -> Known.DECREMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -3455,7 +3207,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -3488,9 +3240,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -3576,10 +3326,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -3685,15 +3440,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -3760,7 +3506,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -3782,7 +3527,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("expiration_change") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -3921,16 +3666,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("expiration_change") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -4032,7 +3780,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -4052,7 +3799,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -4077,7 +3824,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("expiration_change")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -4110,7 +3861,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -4710,129 +4461,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EXPIRATION_CHANGE = of("expiration_change") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EXPIRATION_CHANGE, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EXPIRATION_CHANGE -> Value.EXPIRATION_CHANGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -4971,7 +4599,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -5003,9 +4631,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -5087,10 +4713,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -5189,15 +4820,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -5254,7 +4876,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5275,7 +4896,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("credit_block_expiry") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -5412,16 +5033,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("credit_block_expiry") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -5502,7 +5126,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -5521,7 +5144,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -5545,7 +5168,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("credit_block_expiry")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -5577,7 +5204,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("credit_block_expiry")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -6176,129 +5803,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CREDIT_BLOCK_EXPIRY = of("credit_block_expiry") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - CREDIT_BLOCK_EXPIRY - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CREDIT_BLOCK_EXPIRY, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CREDIT_BLOCK_EXPIRY -> Value.CREDIT_BLOCK_EXPIRY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CREDIT_BLOCK_EXPIRY -> Known.CREDIT_BLOCK_EXPIRY - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -6437,7 +5941,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -6471,9 +5975,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -6563,10 +6065,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -6677,15 +6184,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -6759,7 +6257,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -6782,7 +6279,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -6922,16 +6419,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -7037,7 +6537,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -7058,7 +6557,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -7084,7 +6583,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -7118,7 +6621,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) + @@ -7663,131 +7166,8 @@ private constructor( fun known(): Known = when (this) { COMMITTED -> Known.COMMITTED - PENDING -> Known.PENDING - else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + PENDING -> Known.PENDING + else -> throw OrbInvalidDataException("Unknown EntryStatus: $value") } /** @@ -7804,7 +7184,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EntryType = apply { + fun validate(): EntryStatus = apply { if (validated) { return@apply } @@ -7834,7 +7214,7 @@ private constructor( return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is EntryStatus && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -7980,7 +7360,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val newBlockExpiryDate: JsonField, @@ -8015,9 +7395,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -8111,10 +7489,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -8232,15 +7615,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -8324,7 +7698,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8348,7 +7721,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("void_initiated") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var newBlockExpiryDate: JsonField? = null @@ -8490,16 +7863,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("void_initiated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -8619,7 +7995,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .newBlockExpiryDate() @@ -8641,7 +8016,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("newBlockExpiryDate", newBlockExpiryDate), @@ -8668,7 +8043,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("void_initiated")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() newBlockExpiryDate() @@ -8703,7 +8082,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("void_initiated")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) + @@ -9305,129 +8684,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val VOID_INITIATED = of("void_initiated") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID_INITIATED - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - VOID_INITIATED, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VOID_INITIATED -> Value.VOID_INITIATED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VOID_INITIATED -> Known.VOID_INITIATED - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the @@ -9566,7 +8822,7 @@ private constructor( private val description: JsonField, private val endingBalance: JsonField, private val entryStatus: JsonField, - private val entryType: JsonField, + private val entryType: JsonValue, private val ledgerSequenceNumber: JsonField, private val metadata: JsonField, private val startingBalance: JsonField, @@ -9598,9 +8854,7 @@ private constructor( @JsonProperty("entry_status") @ExcludeMissing entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - entryType: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), @JsonProperty("ledger_sequence_number") @ExcludeMissing ledgerSequenceNumber: JsonField = JsonMissing.of(), @@ -9682,10 +8936,15 @@ private constructor( fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun entryType(): EntryType = entryType.getRequired("entry_type") + @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -9784,15 +9043,6 @@ private constructor( @ExcludeMissing fun _entryStatus(): JsonField = entryStatus - /** - * Returns the raw JSON value of [entryType]. - * - * Unlike [entryType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - /** * Returns the raw JSON value of [ledgerSequenceNumber]. * @@ -9848,7 +9098,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -9869,7 +9118,7 @@ private constructor( private var description: JsonField? = null private var endingBalance: JsonField? = null private var entryStatus: JsonField? = null - private var entryType: JsonField? = null + private var entryType: JsonValue = JsonValue.from("amendment") private var ledgerSequenceNumber: JsonField? = null private var metadata: JsonField? = null private var startingBalance: JsonField? = null @@ -10005,16 +9254,19 @@ private constructor( this.entryStatus = entryStatus } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** - * Sets [Builder.entryType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.entryType] with a well-typed [EntryType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amendment") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) @@ -10095,7 +9347,6 @@ private constructor( * .description() * .endingBalance() * .entryStatus() - * .entryType() * .ledgerSequenceNumber() * .metadata() * .startingBalance() @@ -10114,7 +9365,7 @@ private constructor( checkRequired("description", description), checkRequired("endingBalance", endingBalance), checkRequired("entryStatus", entryStatus), - checkRequired("entryType", entryType), + entryType, checkRequired("ledgerSequenceNumber", ledgerSequenceNumber), checkRequired("metadata", metadata), checkRequired("startingBalance", startingBalance), @@ -10138,7 +9389,11 @@ private constructor( description() endingBalance() entryStatus().validate() - entryType().validate() + _entryType().let { + if (it != JsonValue.from("amendment")) { + throw OrbInvalidDataException("'entryType' is invalid, received $it") + } + } ledgerSequenceNumber() metadata().validate() startingBalance() @@ -10170,7 +9425,7 @@ private constructor( (if (description.asKnown().isPresent) 1 else 0) + (if (endingBalance.asKnown().isPresent) 1 else 0) + (entryStatus.asKnown().getOrNull()?.validity() ?: 0) + - (entryType.asKnown().getOrNull()?.validity() ?: 0) + + entryType.let { if (it == JsonValue.from("amendment")) 1 else 0 } + (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (startingBalance.asKnown().isPresent) 1 else 0) @@ -10769,129 +10024,6 @@ private constructor( override fun toString() = value.toString() } - class EntryType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMENDMENT = of("amendment") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } - - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT - } - - /** - * An enum containing [EntryType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EntryType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMENDMENT, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMENDMENT -> Value.AMENDMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMENDMENT -> Known.AMENDMENT - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EntryType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * User specified key-value pairs for the resource. If not present, this defaults to an * empty dictionary. Individual keys can be removed by setting the value to `null`, and the 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 abdb287cc..ca045da8a 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 @@ -824,7 +824,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewAvalaraTaxConfiguration.builder() - * .taxProvider(CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider.AVALARA) * .taxExempt(taxExempt) * .build() * ``` @@ -842,7 +841,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewTaxJarConfiguration.builder() - * .taxProvider(CustomerUpdateByExternalIdParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider.TAXJAR) * .taxExempt(taxExempt) * .build() * ``` @@ -2036,7 +2034,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewAvalaraTaxConfiguration.builder() - * .taxProvider(CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider.AVALARA) * .taxExempt(taxExempt) * .build() * ``` @@ -2044,12 +2041,6 @@ private constructor( fun newAvalaraTaxConfiguration(taxExempt: Boolean) = taxConfiguration( TaxConfiguration.NewAvalaraTaxConfiguration.builder() - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration - .NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExempt(taxExempt) .build() ) @@ -2064,21 +2055,13 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewTaxJarConfiguration.builder() - * .taxProvider(CustomerUpdateByExternalIdParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider.TAXJAR) * .taxExempt(taxExempt) * .build() * ``` */ fun newTaxJarTaxConfiguration(taxExempt: Boolean) = taxConfiguration( - TaxConfiguration.NewTaxJarConfiguration.builder() - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewTaxJarConfiguration - .TaxProvider - .TAXJAR - ) - .taxExempt(taxExempt) - .build() + TaxConfiguration.NewTaxJarConfiguration.builder().taxExempt(taxExempt).build() ) /** @@ -4213,7 +4196,7 @@ private constructor( class NewAvalaraTaxConfiguration private constructor( private val taxExempt: JsonField, - private val taxProvider: JsonField, + private val taxProvider: JsonValue, private val taxExemptionCode: JsonField, private val additionalProperties: MutableMap, ) { @@ -4225,7 +4208,7 @@ private constructor( taxExempt: JsonField = JsonMissing.of(), @JsonProperty("tax_provider") @ExcludeMissing - taxProvider: JsonField = JsonMissing.of(), + taxProvider: JsonValue = JsonMissing.of(), @JsonProperty("tax_exemption_code") @ExcludeMissing taxExemptionCode: JsonField = JsonMissing.of(), @@ -4239,11 +4222,17 @@ private constructor( fun taxExempt(): Boolean = taxExempt.getRequired("tax_exempt") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("avalara") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun taxProvider(): TaxProvider = taxProvider.getRequired("tax_provider") + @JsonProperty("tax_provider") + @ExcludeMissing + fun _taxProvider(): JsonValue = taxProvider /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -4262,16 +4251,6 @@ private constructor( @ExcludeMissing fun _taxExempt(): JsonField = taxExempt - /** - * Returns the raw JSON value of [taxProvider]. - * - * Unlike [taxProvider], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tax_provider") - @ExcludeMissing - fun _taxProvider(): JsonField = taxProvider - /** * Returns the raw JSON value of [taxExemptionCode]. * @@ -4303,7 +4282,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` */ @JvmStatic fun builder() = Builder() @@ -4313,7 +4291,7 @@ private constructor( class Builder internal constructor() { private var taxExempt: JsonField? = null - private var taxProvider: JsonField? = null + private var taxProvider: JsonValue = JsonValue.from("avalara") private var taxExemptionCode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -4337,18 +4315,19 @@ private constructor( */ fun taxExempt(taxExempt: JsonField) = apply { this.taxExempt = taxExempt } - fun taxProvider(taxProvider: TaxProvider) = taxProvider(JsonField.of(taxProvider)) - /** - * Sets [Builder.taxProvider] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.taxProvider] with a well-typed [TaxProvider] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("avalara") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun taxProvider(taxProvider: JsonField) = apply { - this.taxProvider = taxProvider - } + fun taxProvider(taxProvider: JsonValue) = apply { this.taxProvider = taxProvider } fun taxExemptionCode(taxExemptionCode: String?) = taxExemptionCode(JsonField.ofNullable(taxExemptionCode)) @@ -4401,7 +4380,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4409,7 +4387,7 @@ private constructor( fun build(): NewAvalaraTaxConfiguration = NewAvalaraTaxConfiguration( checkRequired("taxExempt", taxExempt), - checkRequired("taxProvider", taxProvider), + taxProvider, taxExemptionCode, additionalProperties.toMutableMap(), ) @@ -4423,7 +4401,11 @@ private constructor( } taxExempt() - taxProvider().validate() + _taxProvider().let { + if (it != JsonValue.from("avalara")) { + throw OrbInvalidDataException("'taxProvider' is invalid, received $it") + } + } taxExemptionCode() validated = true } @@ -4445,135 +4427,9 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (taxExempt.asKnown().isPresent) 1 else 0) + - (taxProvider.asKnown().getOrNull()?.validity() ?: 0) + + taxProvider.let { if (it == JsonValue.from("avalara")) 1 else 0 } + (if (taxExemptionCode.asKnown().isPresent) 1 else 0) - class TaxProvider - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AVALARA = of("avalara") - - @JvmStatic fun of(value: String) = TaxProvider(JsonField.of(value)) - } - - /** An enum containing [TaxProvider]'s known values. */ - enum class Known { - AVALARA - } - - /** - * An enum containing [TaxProvider]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TaxProvider] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AVALARA, - /** - * An enum member indicating that [TaxProvider] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AVALARA -> Value.AVALARA - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AVALARA -> Known.AVALARA - else -> throw OrbInvalidDataException("Unknown TaxProvider: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TaxProvider = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TaxProvider && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4595,7 +4451,7 @@ private constructor( class NewTaxJarConfiguration private constructor( private val taxExempt: JsonField, - private val taxProvider: JsonField, + private val taxProvider: JsonValue, private val additionalProperties: MutableMap, ) { @@ -4606,7 +4462,7 @@ private constructor( taxExempt: JsonField = JsonMissing.of(), @JsonProperty("tax_provider") @ExcludeMissing - taxProvider: JsonField = JsonMissing.of(), + taxProvider: JsonValue = JsonMissing.of(), ) : this(taxExempt, taxProvider, mutableMapOf()) /** @@ -4617,11 +4473,17 @@ private constructor( fun taxExempt(): Boolean = taxExempt.getRequired("tax_exempt") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("taxjar") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun taxProvider(): TaxProvider = taxProvider.getRequired("tax_provider") + @JsonProperty("tax_provider") + @ExcludeMissing + fun _taxProvider(): JsonValue = taxProvider /** * Returns the raw JSON value of [taxExempt]. @@ -4633,16 +4495,6 @@ private constructor( @ExcludeMissing fun _taxExempt(): JsonField = taxExempt - /** - * Returns the raw JSON value of [taxProvider]. - * - * Unlike [taxProvider], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tax_provider") - @ExcludeMissing - fun _taxProvider(): JsonField = taxProvider - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -4664,7 +4516,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` */ @JvmStatic fun builder() = Builder() @@ -4674,7 +4525,7 @@ private constructor( class Builder internal constructor() { private var taxExempt: JsonField? = null - private var taxProvider: JsonField? = null + private var taxProvider: JsonValue = JsonValue.from("taxjar") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -4696,18 +4547,19 @@ private constructor( */ fun taxExempt(taxExempt: JsonField) = apply { this.taxExempt = taxExempt } - fun taxProvider(taxProvider: TaxProvider) = taxProvider(JsonField.of(taxProvider)) - /** - * Sets [Builder.taxProvider] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.taxProvider] with a well-typed [TaxProvider] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("taxjar") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun taxProvider(taxProvider: JsonField) = apply { - this.taxProvider = taxProvider - } + fun taxProvider(taxProvider: JsonValue) = apply { this.taxProvider = taxProvider } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4739,7 +4591,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4747,7 +4598,7 @@ private constructor( fun build(): NewTaxJarConfiguration = NewTaxJarConfiguration( checkRequired("taxExempt", taxExempt), - checkRequired("taxProvider", taxProvider), + taxProvider, additionalProperties.toMutableMap(), ) } @@ -4760,7 +4611,11 @@ private constructor( } taxExempt() - taxProvider().validate() + _taxProvider().let { + if (it != JsonValue.from("taxjar")) { + throw OrbInvalidDataException("'taxProvider' is invalid, received $it") + } + } validated = true } @@ -4781,133 +4636,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (taxExempt.asKnown().isPresent) 1 else 0) + - (taxProvider.asKnown().getOrNull()?.validity() ?: 0) - - class TaxProvider - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TAXJAR = of("taxjar") - - @JvmStatic fun of(value: String) = TaxProvider(JsonField.of(value)) - } - - /** An enum containing [TaxProvider]'s known values. */ - enum class Known { - TAXJAR - } - - /** - * An enum containing [TaxProvider]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TaxProvider] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TAXJAR, - /** - * An enum member indicating that [TaxProvider] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TAXJAR -> Value.TAXJAR - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TAXJAR -> Known.TAXJAR - else -> throw OrbInvalidDataException("Unknown TaxProvider: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TaxProvider = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TaxProvider && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + taxProvider.let { if (it == JsonValue.from("taxjar")) 1 else 0 } override fun equals(other: Any?): Boolean { if (this === other) { 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 5e40f2bfe..333aac388 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 @@ -822,7 +822,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewAvalaraTaxConfiguration.builder() - * .taxProvider(CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider.AVALARA) * .taxExempt(taxExempt) * .build() * ``` @@ -840,7 +839,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewTaxJarConfiguration.builder() - * .taxProvider(CustomerUpdateParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider.TAXJAR) * .taxExempt(taxExempt) * .build() * ``` @@ -2034,7 +2032,6 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewAvalaraTaxConfiguration.builder() - * .taxProvider(CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider.AVALARA) * .taxExempt(taxExempt) * .build() * ``` @@ -2042,11 +2039,6 @@ private constructor( fun newAvalaraTaxConfiguration(taxExempt: Boolean) = taxConfiguration( TaxConfiguration.NewAvalaraTaxConfiguration.builder() - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExempt(taxExempt) .build() ) @@ -2061,20 +2053,13 @@ private constructor( * Alias for calling [taxConfiguration] with the following: * ```java * TaxConfiguration.NewTaxJarConfiguration.builder() - * .taxProvider(CustomerUpdateParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider.TAXJAR) * .taxExempt(taxExempt) * .build() * ``` */ fun newTaxJarTaxConfiguration(taxExempt: Boolean) = taxConfiguration( - TaxConfiguration.NewTaxJarConfiguration.builder() - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewTaxJarConfiguration.TaxProvider - .TAXJAR - ) - .taxExempt(taxExempt) - .build() + TaxConfiguration.NewTaxJarConfiguration.builder().taxExempt(taxExempt).build() ) /** @@ -4209,7 +4194,7 @@ private constructor( class NewAvalaraTaxConfiguration private constructor( private val taxExempt: JsonField, - private val taxProvider: JsonField, + private val taxProvider: JsonValue, private val taxExemptionCode: JsonField, private val additionalProperties: MutableMap, ) { @@ -4221,7 +4206,7 @@ private constructor( taxExempt: JsonField = JsonMissing.of(), @JsonProperty("tax_provider") @ExcludeMissing - taxProvider: JsonField = JsonMissing.of(), + taxProvider: JsonValue = JsonMissing.of(), @JsonProperty("tax_exemption_code") @ExcludeMissing taxExemptionCode: JsonField = JsonMissing.of(), @@ -4235,11 +4220,17 @@ private constructor( fun taxExempt(): Boolean = taxExempt.getRequired("tax_exempt") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("avalara") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun taxProvider(): TaxProvider = taxProvider.getRequired("tax_provider") + @JsonProperty("tax_provider") + @ExcludeMissing + fun _taxProvider(): JsonValue = taxProvider /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -4258,16 +4249,6 @@ private constructor( @ExcludeMissing fun _taxExempt(): JsonField = taxExempt - /** - * Returns the raw JSON value of [taxProvider]. - * - * Unlike [taxProvider], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tax_provider") - @ExcludeMissing - fun _taxProvider(): JsonField = taxProvider - /** * Returns the raw JSON value of [taxExemptionCode]. * @@ -4299,7 +4280,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` */ @JvmStatic fun builder() = Builder() @@ -4309,7 +4289,7 @@ private constructor( class Builder internal constructor() { private var taxExempt: JsonField? = null - private var taxProvider: JsonField? = null + private var taxProvider: JsonValue = JsonValue.from("avalara") private var taxExemptionCode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -4333,18 +4313,19 @@ private constructor( */ fun taxExempt(taxExempt: JsonField) = apply { this.taxExempt = taxExempt } - fun taxProvider(taxProvider: TaxProvider) = taxProvider(JsonField.of(taxProvider)) - /** - * Sets [Builder.taxProvider] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.taxProvider] with a well-typed [TaxProvider] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("avalara") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun taxProvider(taxProvider: JsonField) = apply { - this.taxProvider = taxProvider - } + fun taxProvider(taxProvider: JsonValue) = apply { this.taxProvider = taxProvider } fun taxExemptionCode(taxExemptionCode: String?) = taxExemptionCode(JsonField.ofNullable(taxExemptionCode)) @@ -4397,7 +4378,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4405,7 +4385,7 @@ private constructor( fun build(): NewAvalaraTaxConfiguration = NewAvalaraTaxConfiguration( checkRequired("taxExempt", taxExempt), - checkRequired("taxProvider", taxProvider), + taxProvider, taxExemptionCode, additionalProperties.toMutableMap(), ) @@ -4419,7 +4399,11 @@ private constructor( } taxExempt() - taxProvider().validate() + _taxProvider().let { + if (it != JsonValue.from("avalara")) { + throw OrbInvalidDataException("'taxProvider' is invalid, received $it") + } + } taxExemptionCode() validated = true } @@ -4441,135 +4425,9 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (taxExempt.asKnown().isPresent) 1 else 0) + - (taxProvider.asKnown().getOrNull()?.validity() ?: 0) + + taxProvider.let { if (it == JsonValue.from("avalara")) 1 else 0 } + (if (taxExemptionCode.asKnown().isPresent) 1 else 0) - class TaxProvider - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AVALARA = of("avalara") - - @JvmStatic fun of(value: String) = TaxProvider(JsonField.of(value)) - } - - /** An enum containing [TaxProvider]'s known values. */ - enum class Known { - AVALARA - } - - /** - * An enum containing [TaxProvider]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TaxProvider] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AVALARA, - /** - * An enum member indicating that [TaxProvider] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AVALARA -> Value.AVALARA - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AVALARA -> Known.AVALARA - else -> throw OrbInvalidDataException("Unknown TaxProvider: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TaxProvider = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TaxProvider && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4591,7 +4449,7 @@ private constructor( class NewTaxJarConfiguration private constructor( private val taxExempt: JsonField, - private val taxProvider: JsonField, + private val taxProvider: JsonValue, private val additionalProperties: MutableMap, ) { @@ -4602,7 +4460,7 @@ private constructor( taxExempt: JsonField = JsonMissing.of(), @JsonProperty("tax_provider") @ExcludeMissing - taxProvider: JsonField = JsonMissing.of(), + taxProvider: JsonValue = JsonMissing.of(), ) : this(taxExempt, taxProvider, mutableMapOf()) /** @@ -4613,11 +4471,17 @@ private constructor( fun taxExempt(): Boolean = taxExempt.getRequired("tax_exempt") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("taxjar") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun taxProvider(): TaxProvider = taxProvider.getRequired("tax_provider") + @JsonProperty("tax_provider") + @ExcludeMissing + fun _taxProvider(): JsonValue = taxProvider /** * Returns the raw JSON value of [taxExempt]. @@ -4629,16 +4493,6 @@ private constructor( @ExcludeMissing fun _taxExempt(): JsonField = taxExempt - /** - * Returns the raw JSON value of [taxProvider]. - * - * Unlike [taxProvider], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tax_provider") - @ExcludeMissing - fun _taxProvider(): JsonField = taxProvider - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -4660,7 +4514,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` */ @JvmStatic fun builder() = Builder() @@ -4670,7 +4523,7 @@ private constructor( class Builder internal constructor() { private var taxExempt: JsonField? = null - private var taxProvider: JsonField? = null + private var taxProvider: JsonValue = JsonValue.from("taxjar") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -4692,18 +4545,19 @@ private constructor( */ fun taxExempt(taxExempt: JsonField) = apply { this.taxExempt = taxExempt } - fun taxProvider(taxProvider: TaxProvider) = taxProvider(JsonField.of(taxProvider)) - /** - * Sets [Builder.taxProvider] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.taxProvider] with a well-typed [TaxProvider] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("taxjar") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun taxProvider(taxProvider: JsonField) = apply { - this.taxProvider = taxProvider - } + fun taxProvider(taxProvider: JsonValue) = apply { this.taxProvider = taxProvider } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4735,7 +4589,6 @@ private constructor( * The following fields are required: * ```java * .taxExempt() - * .taxProvider() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4743,7 +4596,7 @@ private constructor( fun build(): NewTaxJarConfiguration = NewTaxJarConfiguration( checkRequired("taxExempt", taxExempt), - checkRequired("taxProvider", taxProvider), + taxProvider, additionalProperties.toMutableMap(), ) } @@ -4756,7 +4609,11 @@ private constructor( } taxExempt() - taxProvider().validate() + _taxProvider().let { + if (it != JsonValue.from("taxjar")) { + throw OrbInvalidDataException("'taxProvider' is invalid, received $it") + } + } validated = true } @@ -4777,133 +4634,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (taxExempt.asKnown().isPresent) 1 else 0) + - (taxProvider.asKnown().getOrNull()?.validity() ?: 0) - - class TaxProvider - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TAXJAR = of("taxjar") - - @JvmStatic fun of(value: String) = TaxProvider(JsonField.of(value)) - } - - /** An enum containing [TaxProvider]'s known values. */ - enum class Known { - TAXJAR - } - - /** - * An enum containing [TaxProvider]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TaxProvider] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TAXJAR, - /** - * An enum member indicating that [TaxProvider] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TAXJAR -> Value.TAXJAR - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TAXJAR -> Known.TAXJAR - else -> throw OrbInvalidDataException("Unknown TaxProvider: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TaxProvider = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TaxProvider && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + taxProvider.let { if (it == JsonValue.from("taxjar")) 1 else 0 } override fun equals(other: Any?): Boolean { if (this === other) { 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 6af774bea..34b049694 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 @@ -7919,7 +7919,7 @@ private constructor( class MonetaryUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -7933,7 +7933,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -7968,11 +7968,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -8028,16 +8034,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -8105,7 +8101,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -8120,7 +8115,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -8157,17 +8152,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -8291,7 +8288,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -8304,7 +8300,7 @@ private constructor( fun build(): MonetaryUsageDiscountAdjustment = MonetaryUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -8324,7 +8320,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -8350,143 +8352,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8508,7 +8382,7 @@ private constructor( class MonetaryAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -8522,7 +8396,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -8557,11 +8431,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -8617,16 +8497,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -8694,7 +8564,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .amountDiscount() * .appliesToPriceIds() @@ -8709,7 +8578,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amount: JsonField? = null private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null @@ -8746,17 +8615,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -8880,7 +8751,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .amountDiscount() * .appliesToPriceIds() @@ -8893,7 +8763,7 @@ private constructor( fun build(): MonetaryAmountDiscountAdjustment = MonetaryAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -8913,7 +8783,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() amountDiscount() appliesToPriceIds() @@ -8939,143 +8815,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9097,7 +8845,7 @@ private constructor( class MonetaryPercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -9111,7 +8859,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -9146,11 +8894,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -9207,16 +8961,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -9284,7 +9028,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -9299,7 +9042,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -9336,17 +9079,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -9470,7 +9215,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -9483,7 +9227,7 @@ private constructor( fun build(): MonetaryPercentageDiscountAdjustment = MonetaryPercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -9503,7 +9247,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -9529,143 +9279,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9687,7 +9309,7 @@ private constructor( class MonetaryMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -9702,7 +9324,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -9741,11 +9363,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -9810,16 +9438,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -9895,7 +9513,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -9911,7 +9528,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -9949,17 +9566,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -10095,7 +9714,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -10109,7 +9727,7 @@ private constructor( fun build(): MonetaryMinimumAdjustment = MonetaryMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -10130,7 +9748,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -10157,7 +9781,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + @@ -10165,136 +9789,6 @@ private constructor( (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -10316,7 +9810,7 @@ private constructor( class MonetaryMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -10330,7 +9824,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -10365,11 +9859,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -10425,16 +9925,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -10502,7 +9992,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -10517,7 +10006,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -10553,17 +10042,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -10687,7 +10178,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -10700,7 +10190,7 @@ private constructor( fun build(): MonetaryMaximumAdjustment = MonetaryMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -10720,7 +10210,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -10746,143 +10242,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -11576,7 +10942,7 @@ private constructor( private val matrixConfig: JsonField, private val name: JsonField, private val quantity: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -11597,7 +10963,7 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing quantity: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, matrixConfig, name, quantity, type, mutableMapOf()) /** @@ -11637,11 +11003,15 @@ private constructor( fun quantity(): Double = quantity.getRequired("quantity") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -11689,14 +11059,6 @@ private constructor( @ExcludeMissing fun _quantity(): JsonField = quantity - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -11722,7 +11084,6 @@ private constructor( * .matrixConfig() * .name() * .quantity() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -11736,7 +11097,7 @@ private constructor( private var matrixConfig: JsonField? = null private var name: JsonField? = null private var quantity: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("matrix") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -11812,16 +11173,19 @@ private constructor( */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11857,7 +11221,6 @@ private constructor( * .matrixConfig() * .name() * .quantity() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -11869,7 +11232,7 @@ private constructor( checkRequired("matrixConfig", matrixConfig), checkRequired("name", name), checkRequired("quantity", quantity), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -11886,7 +11249,11 @@ private constructor( matrixConfig().validate() name() quantity() - type().validate() + _type().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -11911,7 +11278,7 @@ private constructor( (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("matrix")) 1 else 0 } class Grouping private constructor( @@ -12312,133 +11679,6 @@ private constructor( "MatrixConfig{dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [Type] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -12464,7 +11704,7 @@ private constructor( private val name: JsonField, private val quantity: JsonField, private val tierConfig: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -12485,7 +11725,7 @@ private constructor( @JsonProperty("tier_config") @ExcludeMissing tierConfig: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, name, quantity, tierConfig, type, mutableMapOf()) /** @@ -12525,11 +11765,15 @@ private constructor( fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tier") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -12577,14 +11821,6 @@ private constructor( @ExcludeMissing fun _tierConfig(): JsonField = tierConfig - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -12609,7 +11845,6 @@ private constructor( * .name() * .quantity() * .tierConfig() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -12623,7 +11858,7 @@ private constructor( private var name: JsonField? = null private var quantity: JsonField? = null private var tierConfig: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("tier") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -12698,16 +11933,19 @@ private constructor( this.tierConfig = tierConfig } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tier") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12743,7 +11981,6 @@ private constructor( * .name() * .quantity() * .tierConfig() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -12755,7 +11992,7 @@ private constructor( checkRequired("name", name), checkRequired("quantity", quantity), checkRequired("tierConfig", tierConfig), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -12772,7 +12009,11 @@ private constructor( name() quantity() tierConfig().validate() - type().validate() + _type().let { + if (it != JsonValue.from("tier")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -12797,7 +12038,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + (tierConfig.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("tier")) 1 else 0 } class Grouping private constructor( @@ -13266,133 +12507,6 @@ private constructor( "TierConfig{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIER = of("tier") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - TIER - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIER, - /** - * An enum member indicating that [Type] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIER -> Value.TIER - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIER -> Known.TIER - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -13417,7 +12531,7 @@ private constructor( private val grouping: JsonField, private val name: JsonField, private val quantity: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -13435,7 +12549,7 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing quantity: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, name, quantity, type, mutableMapOf()) /** @@ -13468,11 +12582,15 @@ private constructor( fun quantity(): Double = quantity.getRequired("quantity") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("'null'") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -13510,14 +12628,6 @@ private constructor( @ExcludeMissing fun _quantity(): JsonField = quantity - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -13541,7 +12651,6 @@ private constructor( * .grouping() * .name() * .quantity() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -13554,7 +12663,7 @@ private constructor( private var grouping: JsonField? = null private var name: JsonField? = null private var quantity: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("'null'") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -13615,16 +12724,19 @@ private constructor( */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("'null'") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13659,7 +12771,6 @@ private constructor( * .grouping() * .name() * .quantity() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -13670,7 +12781,7 @@ private constructor( checkRequired("grouping", grouping), checkRequired("name", name), checkRequired("quantity", quantity), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -13686,7 +12797,11 @@ private constructor( grouping().ifPresent { it.validate() } name() quantity() - type().validate() + _type().let { + if (it != JsonValue.from("'null'")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -13710,7 +12825,7 @@ private constructor( (grouping.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("'null'")) 1 else 0 } class Grouping private constructor( @@ -13919,133 +13034,6 @@ private constructor( "Grouping{key=$key, value=$value, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val NULL = of("'null'") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - NULL - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - NULL, - /** - * An enum member indicating that [Type] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NULL -> Value.NULL - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - NULL -> Known.NULL - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 c45d72647..3855cd15c 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 @@ -7910,7 +7910,7 @@ private constructor( class MonetaryUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -7924,7 +7924,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -7959,11 +7959,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -8019,16 +8025,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -8096,7 +8092,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -8111,7 +8106,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -8148,17 +8143,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -8282,7 +8279,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -8295,7 +8291,7 @@ private constructor( fun build(): MonetaryUsageDiscountAdjustment = MonetaryUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -8315,7 +8311,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -8341,143 +8343,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8499,7 +8373,7 @@ private constructor( class MonetaryAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -8513,7 +8387,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -8548,11 +8422,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -8608,16 +8488,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -8685,7 +8555,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .amountDiscount() * .appliesToPriceIds() @@ -8700,7 +8569,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amount: JsonField? = null private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null @@ -8737,17 +8606,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -8871,7 +8742,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .amountDiscount() * .appliesToPriceIds() @@ -8884,7 +8754,7 @@ private constructor( fun build(): MonetaryAmountDiscountAdjustment = MonetaryAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -8904,7 +8774,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() amountDiscount() appliesToPriceIds() @@ -8930,143 +8806,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9088,7 +8836,7 @@ private constructor( class MonetaryPercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -9102,7 +8850,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -9137,11 +8885,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -9198,16 +8952,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -9275,7 +9019,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -9290,7 +9033,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -9327,17 +9070,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -9461,7 +9206,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -9474,7 +9218,7 @@ private constructor( fun build(): MonetaryPercentageDiscountAdjustment = MonetaryPercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -9494,7 +9238,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -9520,143 +9270,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9678,7 +9300,7 @@ private constructor( class MonetaryMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -9693,7 +9315,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -9732,11 +9354,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -9801,16 +9429,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -9886,7 +9504,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -9902,7 +9519,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -9940,17 +9557,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -10086,7 +9705,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -10100,7 +9718,7 @@ private constructor( fun build(): MonetaryMinimumAdjustment = MonetaryMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -10121,7 +9739,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -10148,7 +9772,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + @@ -10156,136 +9780,6 @@ private constructor( (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -10307,7 +9801,7 @@ private constructor( class MonetaryMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -10321,7 +9815,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -10356,11 +9850,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -10416,16 +9916,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -10493,7 +9983,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -10508,7 +9997,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -10544,17 +10033,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -10678,7 +10169,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -10691,7 +10181,7 @@ private constructor( fun build(): MonetaryMaximumAdjustment = MonetaryMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -10711,7 +10201,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -10737,143 +10233,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -11567,7 +10933,7 @@ private constructor( private val matrixConfig: JsonField, private val name: JsonField, private val quantity: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -11588,7 +10954,7 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing quantity: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, matrixConfig, name, quantity, type, mutableMapOf()) /** @@ -11628,11 +10994,15 @@ private constructor( fun quantity(): Double = quantity.getRequired("quantity") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -11680,14 +11050,6 @@ private constructor( @ExcludeMissing fun _quantity(): JsonField = quantity - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -11713,7 +11075,6 @@ private constructor( * .matrixConfig() * .name() * .quantity() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -11727,7 +11088,7 @@ private constructor( private var matrixConfig: JsonField? = null private var name: JsonField? = null private var quantity: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("matrix") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -11803,16 +11164,19 @@ private constructor( */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11848,7 +11212,6 @@ private constructor( * .matrixConfig() * .name() * .quantity() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -11860,7 +11223,7 @@ private constructor( checkRequired("matrixConfig", matrixConfig), checkRequired("name", name), checkRequired("quantity", quantity), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -11877,7 +11240,11 @@ private constructor( matrixConfig().validate() name() quantity() - type().validate() + _type().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -11902,7 +11269,7 @@ private constructor( (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("matrix")) 1 else 0 } class Grouping private constructor( @@ -12303,133 +11670,6 @@ private constructor( "MatrixConfig{dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [Type] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -12455,7 +11695,7 @@ private constructor( private val name: JsonField, private val quantity: JsonField, private val tierConfig: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -12476,7 +11716,7 @@ private constructor( @JsonProperty("tier_config") @ExcludeMissing tierConfig: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, name, quantity, tierConfig, type, mutableMapOf()) /** @@ -12516,11 +11756,15 @@ private constructor( fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tier") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -12568,14 +11812,6 @@ private constructor( @ExcludeMissing fun _tierConfig(): JsonField = tierConfig - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -12600,7 +11836,6 @@ private constructor( * .name() * .quantity() * .tierConfig() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -12614,7 +11849,7 @@ private constructor( private var name: JsonField? = null private var quantity: JsonField? = null private var tierConfig: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("tier") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -12689,16 +11924,19 @@ private constructor( this.tierConfig = tierConfig } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tier") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12734,7 +11972,6 @@ private constructor( * .name() * .quantity() * .tierConfig() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -12746,7 +11983,7 @@ private constructor( checkRequired("name", name), checkRequired("quantity", quantity), checkRequired("tierConfig", tierConfig), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -12763,7 +12000,11 @@ private constructor( name() quantity() tierConfig().validate() - type().validate() + _type().let { + if (it != JsonValue.from("tier")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -12788,7 +12029,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + (tierConfig.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("tier")) 1 else 0 } class Grouping private constructor( @@ -13257,133 +12498,6 @@ private constructor( "TierConfig{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIER = of("tier") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - TIER - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIER, - /** - * An enum member indicating that [Type] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIER -> Value.TIER - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIER -> Known.TIER - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -13408,7 +12522,7 @@ private constructor( private val grouping: JsonField, private val name: JsonField, private val quantity: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -13426,7 +12540,7 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing quantity: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, name, quantity, type, mutableMapOf()) /** @@ -13459,11 +12573,15 @@ private constructor( fun quantity(): Double = quantity.getRequired("quantity") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("'null'") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -13501,14 +12619,6 @@ private constructor( @ExcludeMissing fun _quantity(): JsonField = quantity - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -13532,7 +12642,6 @@ private constructor( * .grouping() * .name() * .quantity() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -13545,7 +12654,7 @@ private constructor( private var grouping: JsonField? = null private var name: JsonField? = null private var quantity: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("'null'") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -13606,16 +12715,19 @@ private constructor( */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("'null'") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13650,7 +12762,6 @@ private constructor( * .grouping() * .name() * .quantity() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -13661,7 +12772,7 @@ private constructor( checkRequired("grouping", grouping), checkRequired("name", name), checkRequired("quantity", quantity), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -13677,7 +12788,11 @@ private constructor( grouping().ifPresent { it.validate() } name() quantity() - type().validate() + _type().let { + if (it != JsonValue.from("'null'")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -13701,7 +12816,7 @@ private constructor( (grouping.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("'null'")) 1 else 0 } class Grouping private constructor( @@ -13910,133 +13025,6 @@ private constructor( "Grouping{key=$key, value=$value, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val NULL = of("'null'") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - NULL - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - NULL, - /** - * An enum member indicating that [Type] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NULL -> Value.NULL - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - NULL -> Known.NULL - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 5d8baa87d..750003fd1 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 @@ -15,7 +15,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer -import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing @@ -1663,7 +1662,7 @@ private constructor( class MonetaryUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -1677,7 +1676,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -1712,11 +1711,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -1772,16 +1777,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -1847,7 +1842,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -1862,7 +1856,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -1897,17 +1891,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2031,7 +2027,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -2044,7 +2039,7 @@ private constructor( fun build(): MonetaryUsageDiscountAdjustment = MonetaryUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -2064,7 +2059,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -2090,141 +2089,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2246,7 +2117,7 @@ private constructor( class MonetaryAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -2260,7 +2131,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -2293,11 +2164,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -2353,16 +2230,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -2428,7 +2295,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .amountDiscount() * .appliesToPriceIds() @@ -2443,7 +2309,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amount: JsonField? = null private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null @@ -2480,17 +2346,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2614,7 +2482,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .amountDiscount() * .appliesToPriceIds() @@ -2627,7 +2494,7 @@ private constructor( fun build(): MonetaryAmountDiscountAdjustment = MonetaryAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2647,7 +2514,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } amount() amountDiscount() appliesToPriceIds() @@ -2673,141 +2544,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2829,7 +2572,7 @@ private constructor( class MonetaryPercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2843,7 +2586,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -2876,11 +2619,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -2936,16 +2685,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -3011,7 +2750,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3026,7 +2764,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3063,17 +2801,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3197,7 +2937,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3210,7 +2949,7 @@ private constructor( fun build(): MonetaryPercentageDiscountAdjustment = MonetaryPercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3230,7 +2969,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -3256,141 +2999,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3412,7 +3029,7 @@ private constructor( class MonetaryMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -3427,7 +3044,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -3464,11 +3081,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -3533,16 +3156,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -3615,7 +3228,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3631,7 +3243,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3666,17 +3278,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3812,7 +3426,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3826,7 +3439,7 @@ private constructor( fun build(): MonetaryMinimumAdjustment = MonetaryMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3847,7 +3460,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -3874,7 +3491,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + @@ -3882,134 +3499,6 @@ private constructor( (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4031,7 +3520,7 @@ private constructor( class MonetaryMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -4045,7 +3534,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @@ -4078,11 +3567,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The value applied by an adjustment. @@ -4138,16 +3633,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amount]. * @@ -4213,7 +3698,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -4228,7 +3712,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var amount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -4261,17 +3745,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4395,7 +3881,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -4408,7 +3893,7 @@ private constructor( fun build(): MonetaryMaximumAdjustment = MonetaryMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amount", amount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -4428,7 +3913,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } amount() appliesToPriceIds() isInvoiceLevel() @@ -4454,141 +3943,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (if (amount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5266,7 +4627,7 @@ private constructor( private val matrixConfig: JsonField, private val name: JsonField, private val quantity: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -5285,7 +4646,7 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing quantity: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, matrixConfig, name, quantity, type, mutableMapOf()) /** @@ -5324,12 +4685,16 @@ private constructor( */ fun quantity(): Double = quantity.getRequired("quantity") - /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + /** + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -5373,13 +4738,6 @@ private constructor( */ @JsonProperty("quantity") @ExcludeMissing fun _quantity(): JsonField = quantity - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -5404,7 +4762,6 @@ private constructor( * .matrixConfig() * .name() * .quantity() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -5418,7 +4775,7 @@ private constructor( private var matrixConfig: JsonField? = null private var name: JsonField? = null private var quantity: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("matrix") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5494,16 +4851,19 @@ private constructor( */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix") + * ``` * - * You should usually call [Builder.type] with a well-typed [Type] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5539,7 +4899,6 @@ private constructor( * .matrixConfig() * .name() * .quantity() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -5551,7 +4910,7 @@ private constructor( checkRequired("matrixConfig", matrixConfig), checkRequired("name", name), checkRequired("quantity", quantity), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -5568,7 +4927,11 @@ private constructor( matrixConfig().validate() name() quantity() - type().validate() + _type().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -5593,7 +4956,7 @@ private constructor( (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("matrix")) 1 else 0 } class Grouping private constructor( @@ -5987,130 +5350,6 @@ private constructor( "MatrixConfig{dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6136,7 +5375,7 @@ private constructor( private val name: JsonField, private val quantity: JsonField, private val tierConfig: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -6155,7 +5394,7 @@ private constructor( @JsonProperty("tier_config") @ExcludeMissing tierConfig: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, name, quantity, tierConfig, type, mutableMapOf()) /** @@ -6195,11 +5434,15 @@ private constructor( fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tier") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -6243,13 +5486,6 @@ private constructor( @ExcludeMissing fun _tierConfig(): JsonField = tierConfig - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -6274,7 +5510,6 @@ private constructor( * .name() * .quantity() * .tierConfig() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -6288,7 +5523,7 @@ private constructor( private var name: JsonField? = null private var quantity: JsonField? = null private var tierConfig: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("tier") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -6363,16 +5598,19 @@ private constructor( this.tierConfig = tierConfig } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tier") + * ``` * - * You should usually call [Builder.type] with a well-typed [Type] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6408,7 +5646,6 @@ private constructor( * .name() * .quantity() * .tierConfig() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -6420,7 +5657,7 @@ private constructor( checkRequired("name", name), checkRequired("quantity", quantity), checkRequired("tierConfig", tierConfig), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -6437,7 +5674,11 @@ private constructor( name() quantity() tierConfig().validate() - type().validate() + _type().let { + if (it != JsonValue.from("tier")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -6462,7 +5703,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + (tierConfig.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("tier")) 1 else 0 } class Grouping private constructor( @@ -6924,130 +6165,6 @@ private constructor( "TierConfig{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIER = of("tier") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - TIER - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIER, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIER -> Value.TIER - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIER -> Known.TIER - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7072,7 +6189,7 @@ private constructor( private val grouping: JsonField, private val name: JsonField, private val quantity: JsonField, - private val type: JsonField, + private val type: JsonValue, private val additionalProperties: MutableMap, ) { @@ -7088,7 +6205,7 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing quantity: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), ) : this(amount, grouping, name, quantity, type, mutableMapOf()) /** @@ -7121,11 +6238,15 @@ private constructor( fun quantity(): Double = quantity.getRequired("quantity") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("'null'") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun type(): Type = type.getRequired("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** * Returns the raw JSON value of [amount]. @@ -7159,13 +6280,6 @@ private constructor( */ @JsonProperty("quantity") @ExcludeMissing fun _quantity(): JsonField = quantity - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -7189,7 +6303,6 @@ private constructor( * .grouping() * .name() * .quantity() - * .type() * ``` */ @JvmStatic fun builder() = Builder() @@ -7202,7 +6315,7 @@ private constructor( private var grouping: JsonField? = null private var name: JsonField? = null private var quantity: JsonField? = null - private var type: JsonField? = null + private var type: JsonValue = JsonValue.from("'null'") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -7263,16 +6376,19 @@ private constructor( */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun type(type: Type) = type(JsonField.of(type)) - /** - * Sets [Builder.type] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("'null'") + * ``` * - * You should usually call [Builder.type] with a well-typed [Type] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun type(type: JsonField) = apply { this.type = type } + fun type(type: JsonValue) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7307,7 +6423,6 @@ private constructor( * .grouping() * .name() * .quantity() - * .type() * ``` * * @throws IllegalStateException if any required field is unset. @@ -7318,7 +6433,7 @@ private constructor( checkRequired("grouping", grouping), checkRequired("name", name), checkRequired("quantity", quantity), - checkRequired("type", type), + type, additionalProperties.toMutableMap(), ) } @@ -7334,7 +6449,11 @@ private constructor( grouping().ifPresent { it.validate() } name() quantity() - type().validate() + _type().let { + if (it != JsonValue.from("'null'")) { + throw OrbInvalidDataException("'type' is invalid, received $it") + } + } validated = true } @@ -7358,7 +6477,7 @@ private constructor( (grouping.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (quantity.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("'null'")) 1 else 0 } class Grouping private constructor( @@ -7563,130 +6682,6 @@ private constructor( "Grouping{key=$key, value=$value, additionalProperties=$additionalProperties}" } - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val NULL = of("'null'") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - NULL - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - NULL, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NULL -> Value.NULL - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - NULL -> Known.NULL - else -> throw OrbInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 4ac065c9a..2385aa899 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 @@ -1677,7 +1677,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -1691,7 +1691,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -1726,11 +1726,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -1785,16 +1791,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -1863,7 +1859,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -1878,7 +1873,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -1915,17 +1910,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2065,7 +2062,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2078,7 +2074,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2098,7 +2094,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2124,141 +2124,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2280,7 +2152,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2294,7 +2166,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2327,11 +2199,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2386,16 +2264,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -2464,7 +2332,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -2479,7 +2346,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -2516,17 +2383,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2666,7 +2535,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -2679,7 +2547,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -2699,7 +2567,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -2725,141 +2597,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2881,7 +2625,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -2895,7 +2639,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2928,11 +2672,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2987,16 +2737,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3065,7 +2805,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3080,7 +2819,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3117,17 +2856,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3267,7 +3008,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3280,7 +3020,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3300,7 +3040,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3326,141 +3070,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3482,7 +3100,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -3497,7 +3115,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3534,11 +3152,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3602,16 +3226,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3687,7 +3301,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -3703,7 +3316,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -3738,17 +3351,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3900,7 +3515,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -3914,7 +3528,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3935,7 +3549,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -3962,7 +3580,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -3970,134 +3588,6 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4119,7 +3609,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4133,7 +3623,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4166,11 +3656,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4225,16 +3721,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4303,7 +3789,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4318,7 +3803,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4351,17 +3836,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4501,7 +3988,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4514,7 +4000,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4534,7 +4020,11 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException("'adjustmentType' is invalid, received $it") + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -4560,141 +4050,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 de56dcf2d..060c743ea 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 @@ -2377,7 +2377,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -2401,9 +2401,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("unit_config") @ExcludeMissing @@ -2477,11 +2475,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -2605,16 +2607,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -2753,7 +2745,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -2766,7 +2757,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -2827,18 +2818,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -3149,7 +3141,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -3160,7 +3151,7 @@ private constructor( NewPlanUnitPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -3186,7 +3177,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -3220,7 +3215,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -3390,131 +3385,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -4533,7 +4403,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -4557,9 +4427,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("package_config") @ExcludeMissing @@ -4633,11 +4501,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -4761,16 +4633,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -4909,7 +4771,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -4922,7 +4783,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -4983,18 +4844,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -5306,7 +5168,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -5317,7 +5178,7 @@ private constructor( NewPlanPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -5343,7 +5204,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -5377,7 +5242,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -5547,131 +5412,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -6741,7 +6481,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -6767,9 +6507,7 @@ private constructor( @JsonProperty("matrix_config") @ExcludeMissing matrixConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -6847,11 +6585,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -6978,16 +6720,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -7117,7 +6849,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -7130,7 +6861,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -7204,18 +6935,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -7514,7 +7246,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -7525,7 +7256,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -7551,7 +7282,11 @@ private constructor( cadence().validate() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -7585,7 +7320,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -8285,131 +8020,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -9258,7 +8868,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -9282,9 +8892,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_config") @ExcludeMissing @@ -9358,11 +8966,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -9486,16 +9098,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -9634,7 +9236,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -9647,7 +9248,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -9708,18 +9309,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -10031,7 +9633,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -10042,7 +9643,7 @@ private constructor( NewPlanTieredPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -10068,7 +9669,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -10102,7 +9707,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -10272,131 +9877,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -11695,7 +11175,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -11719,9 +11199,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_bps_config") @ExcludeMissing @@ -11795,11 +11273,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -11924,16 +11406,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -12073,7 +11545,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -12086,7 +11557,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -12147,18 +11618,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -12470,7 +11942,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -12481,7 +11952,7 @@ private constructor( NewPlanTieredBpsPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -12507,7 +11978,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -12541,7 +12016,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -12711,131 +12186,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -14183,7 +13533,7 @@ private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -14209,9 +13559,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -14289,11 +13637,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -14420,16 +13772,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -14559,7 +13901,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -14572,7 +13913,7 @@ private constructor( private var bpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -14645,18 +13986,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -14955,7 +14297,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -14966,7 +14307,7 @@ private constructor( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -14992,7 +14333,11 @@ private constructor( bpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -15026,7 +14371,7 @@ private constructor( (bpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -15409,131 +14754,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -16383,7 +15603,7 @@ private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -16409,9 +15629,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -16489,11 +15707,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -16620,16 +15842,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -16759,7 +15971,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -16772,7 +15983,7 @@ private constructor( private var bulkBpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -16846,18 +16057,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -17156,7 +16368,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -17167,7 +16378,7 @@ private constructor( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -17193,7 +16404,11 @@ private constructor( bulkBpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -17227,7 +16442,7 @@ private constructor( (bulkBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -17849,131 +17064,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -18823,7 +17913,7 @@ private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -18849,9 +17939,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -18929,11 +18017,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -19060,16 +18152,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -19199,7 +18281,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -19212,7 +18293,7 @@ private constructor( private var bulkConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -19285,18 +18366,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -19595,7 +18677,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -19606,7 +18687,7 @@ private constructor( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -19632,7 +18713,11 @@ private constructor( bulkConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -19666,7 +18751,7 @@ private constructor( (bulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -20245,131 +19330,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -21218,7 +20178,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -21242,9 +20202,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("threshold_total_amount_config") @ExcludeMissing @@ -21319,11 +20277,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -21448,16 +20410,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -21598,7 +20550,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -21611,7 +20562,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -21679,18 +20630,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -22003,7 +20955,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -22014,7 +20965,7 @@ private constructor( NewPlanThresholdTotalAmountPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -22040,7 +20991,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -22074,7 +21029,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("threshold_total_amount")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -22244,99 +21199,78 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { + class ThresholdTotalAmountConfig + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun toBuilder() = Builder().from(this) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } + companion object { - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. + * Returns a mutable builder for constructing an instance of + * [ThresholdTotalAmountConfig]. */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN + /** A builder for [ThresholdTotalAmountConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = + apply { + additionalProperties = + thresholdTotalAmountConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") + 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) } + /** + * Returns an immutable instance of [ThresholdTotalAmountConfig]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ThresholdTotalAmountConfig = + ThresholdTotalAmountConfig(additionalProperties.toImmutable()) + } + private var validated: Boolean = false - fun validate(): ModelType = apply { + fun validate(): ThresholdTotalAmountConfig = apply { if (validated) { return@apply } - known() validated = true } @@ -22354,31 +21288,97 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + return /* spotless:off */ other is ThresholdTotalAmountConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "ThresholdTotalAmountConfig{additionalProperties=$additionalProperties}" } - class ThresholdTotalAmountConfig - @JsonCreator + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + class BillingCycleConfiguration private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + durationUnit: JsonField = JsonMissing.of(), + ) : this(duration, durationUnit, mutableMapOf()) + + /** + * The duration of the billing period. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun duration(): Long = duration.getRequired("duration") + + /** + * The unit of billing period duration. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** + * Returns the raw JSON value of [duration]. + * + * Unlike [duration], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** + * Returns the raw JSON value of [durationUnit]. + * + * Unlike [durationUnit], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -22386,229 +21386,59 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [ThresholdTotalAmountConfig]. + * [BillingCycleConfiguration]. + * + * The following fields are required: + * ```java + * .duration() + * .durationUnit() + * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [ThresholdTotalAmountConfig]. */ + /** A builder for [BillingCycleConfiguration]. */ class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit additionalProperties = - thresholdTotalAmountConfig.additionalProperties.toMutableMap() + billingCycleConfiguration.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) - } - - /** - * Returns an immutable instance of [ThresholdTotalAmountConfig]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): ThresholdTotalAmountConfig = - ThresholdTotalAmountConfig(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): ThresholdTotalAmountConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> - !value.isNull() && !value.isMissing() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ThresholdTotalAmountConfig && 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() = - "ThresholdTotalAmountConfig{additionalProperties=$additionalProperties}" - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - class BillingCycleConfiguration - private constructor( - private val duration: JsonField, - private val durationUnit: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - durationUnit: JsonField = JsonMissing.of(), - ) : this(duration, durationUnit, mutableMapOf()) - - /** - * The duration of the billing period. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun duration(): Long = duration.getRequired("duration") - - /** - * The unit of billing period duration. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** - * Returns the raw JSON value of [duration]. - * - * Unlike [duration], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("duration") - @ExcludeMissing - fun _duration(): JsonField = duration - - /** - * Returns the raw JSON value of [durationUnit]. - * - * Unlike [durationUnit], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BillingCycleConfiguration]. - * - * The following fields are required: - * ```java - * .duration() - * .durationUnit() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** - * Sets [Builder.duration] to an arbitrary JSON value. - * - * You should usually call [Builder.duration] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** - * Sets [Builder.durationUnit] to an arbitrary JSON value. - * - * You should usually call [Builder.durationUnit] with a well-typed - * [DurationUnit] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** + * Sets [Builder.duration] to an arbitrary JSON value. + * + * You should usually call [Builder.duration] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** + * Sets [Builder.durationUnit] to an arbitrary JSON value. + * + * You should usually call [Builder.durationUnit] with a well-typed + * [DurationUnit] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23330,7 +22160,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -23354,9 +22184,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_config") @ExcludeMissing @@ -23430,11 +22258,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -23559,16 +22391,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -23708,7 +22530,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -23721,7 +22542,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -23784,18 +22605,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -24108,7 +22930,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -24119,7 +22940,7 @@ private constructor( NewPlanTieredPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -24145,7 +22966,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -24179,7 +23004,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -24349,131 +23174,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE = of("tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredPackageConfig @JsonCreator private constructor( @@ -25434,7 +24134,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -25458,9 +24158,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_minimum_config") @ExcludeMissing @@ -25534,11 +24232,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -25663,16 +24365,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -25813,7 +24505,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -25826,7 +24517,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -25892,18 +24583,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -26215,7 +24907,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -26226,7 +24917,7 @@ private constructor( NewPlanTieredWithMinimumPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -26252,7 +24943,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -26286,7 +24981,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -26456,131 +25151,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -27541,7 +26111,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -27565,9 +26135,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("unit_with_percent_config") @ExcludeMissing @@ -27641,11 +26209,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -27770,16 +26342,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -27919,7 +26481,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -27932,7 +26493,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -27997,18 +26558,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -28321,7 +26883,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -28332,7 +26893,7 @@ private constructor( NewPlanUnitWithPercentPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -28358,7 +26919,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -28392,7 +26957,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -28562,131 +27127,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -29647,7 +28087,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -29671,9 +28111,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("package_with_allocation_config") @ExcludeMissing @@ -29748,11 +28186,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -29877,16 +28319,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -30027,7 +28459,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -30040,7 +28471,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = null @@ -30108,18 +28539,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -30432,7 +28864,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -30443,7 +28874,7 @@ private constructor( NewPlanPackageWithAllocationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageWithAllocationConfig", packageWithAllocationConfig), billableMetricId, @@ -30469,7 +28900,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -30503,7 +28938,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -30673,131 +29110,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -31759,7 +30071,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -31783,9 +30095,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_proration_config") @ExcludeMissing @@ -31859,11 +30169,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -31988,16 +30302,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -32138,7 +30442,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -32151,7 +30454,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -32217,18 +30520,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -32541,7 +30845,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -32552,7 +30855,7 @@ private constructor( NewPlanTierWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -32578,7 +30881,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -32612,7 +30919,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -32782,131 +31089,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -33868,7 +32050,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -33892,9 +32074,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("unit_with_proration_config") @ExcludeMissing @@ -33968,11 +32148,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -34097,16 +32281,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -34247,7 +32421,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -34260,7 +32433,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -34326,18 +32499,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -34649,7 +32823,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -34660,7 +32833,7 @@ private constructor( NewPlanUnitWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -34686,7 +32859,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -34720,7 +32897,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -34890,131 +33067,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -35976,7 +34028,7 @@ private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -36002,9 +34054,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -36083,11 +34133,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -36215,16 +34269,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -36355,7 +34399,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -36368,7 +34411,7 @@ private constructor( private var cadence: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -36447,18 +34490,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -36757,7 +34801,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -36768,7 +34811,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -36794,7 +34837,11 @@ private constructor( cadence().validate() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -36828,7 +34875,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -37109,131 +35156,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -38084,7 +36006,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -38111,9 +36033,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -38192,11 +36112,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -38324,16 +36248,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -38464,7 +36378,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -38479,7 +36392,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -38562,18 +36475,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -38872,7 +36786,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -38886,7 +36799,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -38912,7 +36825,11 @@ private constructor( cadence().validate() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -38946,7 +36863,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -39229,132 +37148,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -40204,7 +37997,7 @@ private constructor( private val cadence: JsonField, private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -40231,9 +38024,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -40312,11 +38103,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -40444,16 +38239,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -40584,7 +38369,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -40599,7 +38383,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -40680,18 +38464,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -40990,7 +38775,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -41004,7 +38788,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -41030,7 +38814,11 @@ private constructor( cadence().validate() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -41064,7 +38852,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -41347,131 +39137,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -42321,7 +39986,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -42348,9 +40013,7 @@ private constructor( @ExcludeMissing matrixWithDisplayNameConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -42429,11 +40092,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -42561,16 +40228,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -42701,7 +40358,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -42715,7 +40371,7 @@ private constructor( private var itemId: JsonField? = null private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -42796,18 +40452,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -43106,7 +40763,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -43117,7 +40773,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -43143,7 +40799,11 @@ private constructor( cadence().validate() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -43177,7 +40837,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -43459,131 +41121,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -44433,7 +41970,7 @@ private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -44459,9 +41996,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -44540,11 +42075,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -44672,16 +42211,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -44812,7 +42341,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -44825,7 +42353,7 @@ private constructor( private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -44904,18 +42432,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -45214,7 +42743,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -45225,7 +42753,7 @@ private constructor( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -45251,7 +42779,11 @@ private constructor( bulkWithProrationConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -45285,7 +42817,7 @@ private constructor( (bulkWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -45566,131 +43098,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -46540,7 +43947,7 @@ private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -46567,9 +43974,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -46648,11 +44053,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -46780,16 +44189,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -46920,7 +44319,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -46934,7 +44332,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -47015,18 +44413,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -47325,7 +44724,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -47336,7 +44734,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -47362,7 +44760,11 @@ private constructor( cadence().validate() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -47396,7 +44798,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -47678,131 +45080,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -48652,7 +45929,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -48679,9 +45956,7 @@ private constructor( @ExcludeMissing maxGroupTieredPackageConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -48760,11 +46035,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -48892,16 +46171,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -49032,7 +46301,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -49046,7 +46314,7 @@ private constructor( private var itemId: JsonField? = null private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -49127,18 +46395,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -49437,7 +46706,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -49448,7 +46716,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("maxGroupTieredPackageConfig", maxGroupTieredPackageConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -49474,7 +46742,11 @@ private constructor( cadence().validate() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -49508,7 +46780,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -49790,131 +47064,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -50763,7 +47912,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -50788,9 +47937,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("scalable_matrix_with_unit_pricing_config") @ExcludeMissing @@ -50866,11 +48013,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -50997,16 +48148,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -51147,7 +48288,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -51160,7 +48300,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -51234,18 +48375,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -51564,7 +48706,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -51575,7 +48716,7 @@ private constructor( NewPlanScalableMatrixWithUnitPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -51604,7 +48745,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -51638,7 +48783,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -51808,132 +48955,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -52896,7 +49917,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -52921,9 +49942,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("scalable_matrix_with_tiered_pricing_config") @ExcludeMissing @@ -52999,11 +50018,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -53130,16 +50153,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -53281,7 +50294,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -53294,7 +50306,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -53368,18 +50381,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -53699,7 +50713,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -53710,7 +50723,7 @@ private constructor( NewPlanScalableMatrixWithTieredPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -53739,7 +50752,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -53773,7 +50790,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -53943,135 +50962,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -55036,7 +51926,7 @@ private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -55063,9 +51953,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -55144,11 +52032,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -55276,16 +52168,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -55416,7 +52298,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -55430,7 +52311,7 @@ private constructor( private var cumulativeGroupedBulkConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -55511,18 +52392,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -55821,7 +52703,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -55832,7 +52713,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("cumulativeGroupedBulkConfig", cumulativeGroupedBulkConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -55858,7 +52739,11 @@ private constructor( cadence().validate() cumulativeGroupedBulkConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -55892,7 +52777,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -56174,131 +53061,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ 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 6aa20c660..055f70b08 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 @@ -1054,7 +1054,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -1109,9 +1109,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -1272,10 +1270,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -1465,15 +1468,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -1557,7 +1551,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -1588,7 +1581,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -1954,16 +1947,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -2092,7 +2088,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -2121,7 +2116,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -2156,7 +2151,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -2199,7 +2198,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -4178,129 +4177,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -4867,7 +4743,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val planPhaseOrder: JsonField, @@ -4922,9 +4798,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("package_config") @ExcludeMissing @@ -5085,10 +4959,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -5278,15 +5157,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -5371,7 +5241,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .packageConfig() * .planPhaseOrder() @@ -5402,7 +5271,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -5768,16 +5637,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -5907,7 +5779,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .packageConfig() * .planPhaseOrder() @@ -5936,7 +5807,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), checkRequired("planPhaseOrder", planPhaseOrder), @@ -5971,7 +5842,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() planPhaseOrder() @@ -6014,7 +5889,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + @@ -7993,129 +7868,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -8733,7 +8485,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -8790,9 +8542,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -8956,10 +8706,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -9153,15 +8908,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -9237,7 +8983,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -9268,7 +9013,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -9646,16 +9391,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -9772,7 +9520,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -9801,7 +9548,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -9836,7 +9583,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -9879,7 +9630,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -12383,129 +12134,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -12902,7 +12530,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -12957,9 +12585,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -13120,10 +12746,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -13313,15 +12944,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -13406,7 +13028,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -13437,7 +13058,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -13803,16 +13424,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -13941,7 +13565,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -13970,7 +13593,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -14005,7 +13628,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -14048,7 +13675,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -16027,129 +15654,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -16990,7 +16494,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -17045,9 +16549,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -17208,10 +16710,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -17401,15 +16908,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -17494,7 +16992,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -17525,7 +17022,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -17891,16 +17388,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -18030,7 +17530,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -18059,7 +17558,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -18094,7 +17593,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -18137,7 +17640,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -20116,129 +19619,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -21126,7 +20506,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -21183,9 +20563,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -21349,10 +20727,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -21545,15 +20928,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -21629,7 +21003,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -21660,7 +21033,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -22036,16 +21409,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -22162,7 +21538,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -22191,7 +21566,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -22226,7 +21601,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -22269,7 +21648,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -24459,129 +23838,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -24979,7 +24235,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -25036,9 +24292,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -25202,10 +24456,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -25399,15 +24658,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -25483,7 +24733,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -25514,7 +24763,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -25893,16 +25142,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -26019,7 +25271,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -26048,7 +25299,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -26083,7 +25334,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -26126,7 +25381,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -28550,7 +27805,7 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : + class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -28565,29 +27820,33 @@ private constructor( companion object { - @JvmField val BULK_BPS = of("bulk_bps") + @JvmField val USAGE_PRICE = of("usage_price") + + @JvmField val FIXED_PRICE = of("fixed_price") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) } - /** An enum containing [ModelType]'s known values. */ + /** An enum containing [PriceType]'s known values. */ enum class Known { - BULK_BPS + USAGE_PRICE, + FIXED_PRICE, } /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [ModelType] can contain an unknown value in a couple of cases: + * An instance of [PriceType] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - BULK_BPS, + USAGE_PRICE, + FIXED_PRICE, /** - * An enum member indicating that [ModelType] was instantiated with an unknown + * An enum member indicating that [PriceType] was instantiated with an unknown * value. */ _UNKNOWN, @@ -28602,7 +27861,8 @@ private constructor( */ fun value(): Value = when (this) { - BULK_BPS -> Value.BULK_BPS + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE else -> Value._UNKNOWN } @@ -28617,8 +27877,9 @@ private constructor( */ fun known(): Known = when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") } /** @@ -28635,136 +27896,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class PriceType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_PRICE = of("usage_price") - - @JvmField val FIXED_PRICE = of("fixed_price") - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - /** An enum containing [PriceType]'s known values. */ - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - /** - * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [PriceType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - /** - * An enum member indicating that [PriceType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): PriceType = apply { + fun validate(): PriceType = apply { if (validated) { return@apply } @@ -29070,7 +28202,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -29127,9 +28259,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -29293,10 +28423,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -29489,15 +28624,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -29573,7 +28699,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -29604,7 +28729,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -29982,16 +29107,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -30108,7 +29236,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -30137,7 +29264,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -30172,7 +29299,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -30215,7 +29346,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -32599,129 +31730,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -33118,7 +32126,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -33173,9 +32181,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -33336,10 +32342,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -33530,15 +32541,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -33625,7 +32627,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -33656,7 +32657,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -34023,16 +33024,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -34162,7 +33166,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -34191,7 +33194,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -34226,7 +33229,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -34269,7 +33276,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("threshold_total_amount")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -36248,129 +35255,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -36877,7 +35761,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -36932,9 +35816,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -37095,10 +35977,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -37289,15 +36176,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -37382,7 +36260,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -37413,7 +36290,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -37779,16 +36656,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -37918,7 +36798,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -37947,7 +36826,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -37982,7 +36861,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -38025,7 +36908,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -40004,129 +38887,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE = of("tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -40632,7 +39392,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -40689,9 +39449,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -40856,10 +39614,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -41053,15 +39816,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -41137,7 +39891,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -41168,7 +39921,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -41547,16 +40300,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -41673,7 +40429,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -41702,7 +40457,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -41737,7 +40492,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -41780,7 +40539,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -43866,129 +42625,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED = of("grouped_tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED -> Value.GROUPED_TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED -> Known.GROUPED_TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -44385,7 +43021,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -44440,9 +43076,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -44603,10 +43237,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -44797,15 +43436,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -44890,7 +43520,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -44921,7 +43550,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -45287,16 +43916,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -45426,7 +44058,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -45455,7 +44086,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -45490,7 +44121,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -45533,7 +44168,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -47512,129 +46147,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -48141,7 +46653,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -48196,9 +46708,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -48360,10 +46870,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -48554,15 +47069,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -48649,7 +47155,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -48680,7 +47185,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package_with_minimum") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -49053,16 +47558,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_package_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -49193,7 +47701,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -49222,7 +47729,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -49257,7 +47764,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -49300,7 +47811,9 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_package_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -51279,129 +49792,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE_WITH_MINIMUM = of("tiered_package_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Value.TIERED_PACKAGE_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Known.TIERED_PACKAGE_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -51909,7 +50299,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val planPhaseOrder: JsonField, @@ -51964,9 +50354,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("package_with_allocation_config") @ExcludeMissing @@ -52127,10 +50515,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -52321,15 +50714,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -52416,7 +50800,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .packageWithAllocationConfig() * .planPhaseOrder() @@ -52447,7 +50830,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -52815,16 +51198,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -52955,7 +51341,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .packageWithAllocationConfig() * .planPhaseOrder() @@ -52984,7 +51369,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageWithAllocationConfig", packageWithAllocationConfig), checkRequired("planPhaseOrder", planPhaseOrder), @@ -53019,7 +51404,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() planPhaseOrder() @@ -53062,7 +51451,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package_with_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + @@ -55041,7 +53430,118 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : + class PackageWithAllocationConfig + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [PackageWithAllocationConfig]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PackageWithAllocationConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(packageWithAllocationConfig: PackageWithAllocationConfig) = + apply { + additionalProperties = + packageWithAllocationConfig.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) + } + + /** + * Returns an immutable instance of [PackageWithAllocationConfig]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): PackageWithAllocationConfig = + PackageWithAllocationConfig(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): PackageWithAllocationConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PackageWithAllocationConfig && 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() = + "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" + } + + class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -55056,29 +53556,33 @@ private constructor( companion object { - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") + @JvmField val USAGE_PRICE = of("usage_price") + + @JvmField val FIXED_PRICE = of("fixed_price") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) } - /** An enum containing [ModelType]'s known values. */ + /** An enum containing [PriceType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION + USAGE_PRICE, + FIXED_PRICE, } /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [ModelType] can contain an unknown value in a couple of cases: + * An instance of [PriceType] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - PACKAGE_WITH_ALLOCATION, + USAGE_PRICE, + FIXED_PRICE, /** - * An enum member indicating that [ModelType] was instantiated with an unknown + * An enum member indicating that [PriceType] was instantiated with an unknown * value. */ _UNKNOWN, @@ -55093,7 +53597,8 @@ private constructor( */ fun value(): Value = when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE else -> Value._UNKNOWN } @@ -55108,8 +53613,9 @@ private constructor( */ fun known(): Known = when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") } /** @@ -55126,247 +53632,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class PackageWithAllocationConfig - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [PackageWithAllocationConfig]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PackageWithAllocationConfig]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(packageWithAllocationConfig: PackageWithAllocationConfig) = - apply { - additionalProperties = - packageWithAllocationConfig.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) - } - - /** - * Returns an immutable instance of [PackageWithAllocationConfig]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): PackageWithAllocationConfig = - PackageWithAllocationConfig(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): PackageWithAllocationConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PackageWithAllocationConfig && 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() = - "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" - } - - class PriceType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_PRICE = of("usage_price") - - @JvmField val FIXED_PRICE = of("fixed_price") - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - /** An enum containing [PriceType]'s known values. */ - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - /** - * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [PriceType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - /** - * An enum member indicating that [PriceType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): PriceType = apply { + fun validate(): PriceType = apply { if (validated) { return@apply } @@ -55671,7 +53937,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -55726,9 +53992,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -55889,10 +54153,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -56083,15 +54352,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -56176,7 +54436,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -56207,7 +54466,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -56573,16 +54832,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -56713,7 +54975,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -56742,7 +55003,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -56777,7 +55038,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -56820,7 +55085,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -58799,7 +57064,7 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : + class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -58814,29 +57079,33 @@ private constructor( companion object { - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") + @JvmField val USAGE_PRICE = of("usage_price") + + @JvmField val FIXED_PRICE = of("fixed_price") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) } - /** An enum containing [ModelType]'s known values. */ + /** An enum containing [PriceType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT + USAGE_PRICE, + FIXED_PRICE, } /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [ModelType] can contain an unknown value in a couple of cases: + * An instance of [PriceType] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - UNIT_WITH_PERCENT, + USAGE_PRICE, + FIXED_PRICE, /** - * An enum member indicating that [ModelType] was instantiated with an unknown + * An enum member indicating that [PriceType] was instantiated with an unknown * value. */ _UNKNOWN, @@ -58851,7 +57120,8 @@ private constructor( */ fun value(): Value = when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE else -> Value._UNKNOWN } @@ -58866,8 +57136,9 @@ private constructor( */ fun known(): Known = when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") } /** @@ -58884,136 +57155,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class PriceType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_PRICE = of("usage_price") - - @JvmField val FIXED_PRICE = of("fixed_price") - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - /** An enum containing [PriceType]'s known values. */ - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - /** - * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [PriceType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - /** - * An enum member indicating that [PriceType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): PriceType = apply { + fun validate(): PriceType = apply { if (validated) { return@apply } @@ -59428,7 +57570,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -59485,9 +57627,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -59652,10 +57792,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -59850,15 +57995,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -59935,7 +58071,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -59966,7 +58101,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_allocation") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -60346,16 +58481,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -60472,7 +58610,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -60501,7 +58638,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -60536,7 +58673,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -60579,7 +58720,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix_with_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -63130,129 +61271,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -63649,7 +61667,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -63704,9 +61722,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -63867,10 +61883,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -64061,15 +62082,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -64155,7 +62167,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -64186,7 +62197,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -64553,16 +62564,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -64692,7 +62706,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -64721,7 +62734,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -64756,7 +62769,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -64799,7 +62816,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -66778,129 +64795,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -67407,7 +65301,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -67462,9 +65356,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -67625,10 +65517,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -67819,15 +65716,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -67912,7 +65800,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -67943,7 +65830,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -68309,16 +66196,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -68448,7 +66338,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -68477,7 +66366,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -68512,7 +66401,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -68555,7 +66448,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -70534,129 +68427,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -71164,7 +68934,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -71221,9 +68991,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -71388,10 +69156,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -71585,15 +69358,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -71669,7 +69433,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -71700,7 +69463,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -72079,16 +69842,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -72205,7 +69971,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -72234,7 +69999,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -72269,7 +70034,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -72312,7 +70081,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -74400,129 +72169,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -74920,7 +72566,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -74978,9 +72624,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -75145,10 +72789,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -75343,15 +72992,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -75428,7 +73068,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -75461,7 +73100,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -75847,16 +73486,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -75973,7 +73615,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -76005,7 +73646,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -76040,7 +73681,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -76083,7 +73728,9 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -78173,129 +75820,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -78693,7 +76217,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -78751,9 +76275,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -78918,10 +76440,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -79116,15 +76643,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -79201,7 +76719,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -79234,7 +76751,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -79620,16 +77137,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -79746,7 +77266,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -79778,7 +77297,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -79813,7 +77332,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -79856,7 +77379,9 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -81946,129 +79471,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -82466,7 +79868,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -82523,9 +79925,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -82690,10 +80090,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -82888,15 +80293,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -82973,7 +80369,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -83004,7 +80399,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -83386,16 +80781,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -83512,7 +80910,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -83541,7 +80938,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -83576,7 +80973,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -83619,7 +81020,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -85708,129 +83109,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -86228,7 +83506,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -86285,9 +83563,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -86452,10 +83728,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -86649,15 +83930,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -86733,7 +84005,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -86764,7 +84035,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -87143,16 +84414,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -87269,7 +84543,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -87298,7 +84571,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -87333,7 +84606,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -87376,7 +84653,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -89464,7 +86741,7 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : + class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -89479,29 +86756,33 @@ private constructor( companion object { - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") + @JvmField val USAGE_PRICE = of("usage_price") + + @JvmField val FIXED_PRICE = of("fixed_price") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) } - /** An enum containing [ModelType]'s known values. */ + /** An enum containing [PriceType]'s known values. */ enum class Known { - BULK_WITH_PRORATION + USAGE_PRICE, + FIXED_PRICE, } /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [ModelType] can contain an unknown value in a couple of cases: + * An instance of [PriceType] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - BULK_WITH_PRORATION, + USAGE_PRICE, + FIXED_PRICE, /** - * An enum member indicating that [ModelType] was instantiated with an unknown + * An enum member indicating that [PriceType] was instantiated with an unknown * value. */ _UNKNOWN, @@ -89516,7 +86797,8 @@ private constructor( */ fun value(): Value = when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE else -> Value._UNKNOWN } @@ -89531,8 +86813,9 @@ private constructor( */ fun known(): Known = when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") } /** @@ -89549,136 +86832,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class PriceType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_PRICE = of("usage_price") - - @JvmField val FIXED_PRICE = of("fixed_price") - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - /** An enum containing [PriceType]'s known values. */ - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - /** - * An enum containing [PriceType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [PriceType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - /** - * An enum member indicating that [PriceType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): PriceType = apply { + fun validate(): PriceType = apply { if (validated) { return@apply } @@ -89984,7 +87138,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -90041,9 +87195,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -90208,10 +87360,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -90406,15 +87563,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -90491,7 +87639,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -90522,7 +87669,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -90902,16 +88049,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -91028,7 +88178,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -91057,7 +88206,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -91092,7 +88241,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -91135,7 +88288,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -93223,129 +90376,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -93743,7 +90773,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -93800,9 +90830,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -93967,10 +90995,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -94165,15 +91198,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -94250,7 +91274,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -94281,7 +91304,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -94663,16 +91686,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -94789,7 +91815,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -94818,7 +91843,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -94853,7 +91878,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -94896,7 +91925,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -96985,129 +94014,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -97504,7 +94410,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -97560,9 +94466,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -97724,10 +94628,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -97920,15 +94829,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -98015,7 +94915,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -98046,7 +94945,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -98421,16 +95320,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -98566,7 +95468,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -98595,7 +95496,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -98633,7 +95534,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -98676,7 +95581,9 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -100655,130 +97562,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -101287,7 +98070,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -101343,9 +98126,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -101508,10 +98289,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -101704,15 +98490,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -101799,7 +98576,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -101830,7 +98606,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -102205,16 +98981,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -102351,7 +99130,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -102380,7 +99158,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -102418,7 +99196,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -102461,7 +99243,9 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -104440,130 +101224,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -105073,7 +101733,7 @@ private constructor( private val metadata: JsonField, private val minimum: JsonField, private val minimumAmount: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, @@ -105130,9 +101790,7 @@ private constructor( @JsonProperty("minimum_amount") @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing @@ -105297,10 +101955,15 @@ private constructor( fun minimumAmount(): Optional = minimumAmount.getOptional("minimum_amount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -105495,15 +102158,6 @@ private constructor( @ExcludeMissing fun _minimumAmount(): JsonField = minimumAmount - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -105580,7 +102234,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -105611,7 +102264,7 @@ private constructor( private var metadata: JsonField? = null private var minimum: JsonField? = null private var minimumAmount: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null @@ -105993,16 +102646,19 @@ private constructor( this.minimumAmount = minimumAmount } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } fun name(name: String) = name(JsonField.of(name)) @@ -106119,7 +102775,6 @@ private constructor( * .metadata() * .minimum() * .minimumAmount() - * .modelType() * .name() * .planPhaseOrder() * .priceType() @@ -106148,7 +102803,7 @@ private constructor( checkRequired("metadata", metadata), checkRequired("minimum", minimum), checkRequired("minimumAmount", minimumAmount), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), @@ -106183,7 +102838,11 @@ private constructor( metadata().validate() minimum().ifPresent { it.validate() } minimumAmount() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() planPhaseOrder() priceType().validate() @@ -106226,7 +102885,7 @@ private constructor( (metadata.asKnown().getOrNull()?.validity() ?: 0) + (minimum.asKnown().getOrNull()?.validity() ?: 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + @@ -108315,129 +104974,6 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PriceType @JsonCreator private constructor(private val value: JsonField) : Enum { 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 e9b9c86ee..575362b1d 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 @@ -1831,7 +1831,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -1857,9 +1857,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("unit_config") @ExcludeMissing @@ -1939,11 +1937,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -2066,16 +2068,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -2207,7 +2199,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -2221,7 +2212,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -2293,18 +2284,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -2598,7 +2590,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -2610,7 +2601,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -2636,7 +2627,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -2670,7 +2665,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -2839,131 +2834,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -3983,7 +3853,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -4009,9 +3879,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("package_config") @ExcludeMissing @@ -4091,11 +3959,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -4218,16 +4090,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -4360,7 +4222,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -4374,7 +4235,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -4448,18 +4309,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -4754,7 +4616,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -4766,7 +4627,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -4792,7 +4653,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -4826,7 +4691,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -4995,131 +4860,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -6190,7 +5930,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -6218,9 +5958,7 @@ private constructor( @JsonProperty("matrix_config") @ExcludeMissing matrixConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -6304,11 +6042,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -6434,16 +6176,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -6567,7 +6299,6 @@ private constructor( * .currency() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -6581,7 +6312,7 @@ private constructor( private var currency: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -6667,18 +6398,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -6960,7 +6692,6 @@ private constructor( * .currency() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -6972,7 +6703,7 @@ private constructor( checkRequired("currency", currency), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -6998,7 +6729,11 @@ private constructor( currency() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -7032,7 +6767,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -7731,131 +7466,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -8706,7 +8316,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val matrixWithAllocationConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -8735,9 +8345,7 @@ private constructor( @ExcludeMissing matrixWithAllocationConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -8822,11 +8430,15 @@ private constructor( matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -8953,16 +8565,6 @@ private constructor( fun _matrixWithAllocationConfig(): JsonField = matrixWithAllocationConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -9086,7 +8688,6 @@ private constructor( * .currency() * .itemId() * .matrixWithAllocationConfig() - * .modelType() * .name() * ``` */ @@ -9101,7 +8702,7 @@ private constructor( private var itemId: JsonField? = null private var matrixWithAllocationConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -9193,18 +8794,19 @@ private constructor( matrixWithAllocationConfig: JsonField ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -9486,7 +9088,6 @@ private constructor( * .currency() * .itemId() * .matrixWithAllocationConfig() - * .modelType() * .name() * ``` * @@ -9498,7 +9099,7 @@ private constructor( checkRequired("currency", currency), checkRequired("itemId", itemId), checkRequired("matrixWithAllocationConfig", matrixWithAllocationConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -9524,7 +9125,11 @@ private constructor( currency() itemId() matrixWithAllocationConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -9558,7 +9163,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix_with_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -10306,131 +9911,6 @@ private constructor( "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -11280,7 +10760,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -11306,9 +10786,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_config") @ExcludeMissing @@ -11388,11 +10866,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -11515,16 +10997,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -11657,7 +11129,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -11671,7 +11142,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -11744,18 +11215,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -12050,7 +11522,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -12062,7 +11533,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -12088,7 +11559,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -12122,7 +11597,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -12291,131 +11766,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -13715,7 +13065,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -13741,9 +13091,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_bps_config") @ExcludeMissing @@ -13823,11 +13171,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -13951,16 +13303,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -14093,7 +13435,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -14107,7 +13448,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -14181,18 +13522,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -14487,7 +13829,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -14499,7 +13840,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -14525,7 +13866,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -14559,7 +13904,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -14728,131 +14073,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -16201,7 +15421,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -16229,9 +15449,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -16315,11 +15533,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -16445,16 +15667,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -16577,7 +15789,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -16591,7 +15802,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -16675,18 +15886,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -16968,7 +16180,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -16980,7 +16191,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -17006,7 +16217,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -17040,7 +16255,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -17422,131 +16637,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -18397,7 +17487,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -18425,9 +17515,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -18511,11 +17599,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -18641,16 +17733,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -18774,7 +17856,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -18788,7 +17869,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -18875,18 +17956,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -19168,7 +18250,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -19180,7 +18261,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -19206,7 +18287,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -19240,7 +18325,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -19861,131 +18946,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -20836,7 +19796,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -20864,9 +19824,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -20950,11 +19908,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -21080,16 +20042,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -21212,7 +20164,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -21226,7 +20177,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -21310,18 +20261,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -21603,7 +20555,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -21615,7 +20566,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -21641,7 +20592,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -21675,7 +20630,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -22253,131 +21208,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -23227,7 +22057,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -23253,9 +22083,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("threshold_total_amount_config") @ExcludeMissing @@ -23336,11 +22164,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -23464,16 +22296,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -23607,7 +22429,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -23621,7 +22442,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -23700,18 +22521,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -24007,7 +22829,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -24019,7 +22840,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -24045,7 +22866,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -24079,7 +22904,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("threshold_total_amount")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -24248,131 +23073,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ThresholdTotalAmountConfig @JsonCreator private constructor( @@ -25335,7 +24035,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -25361,9 +24061,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_config") @ExcludeMissing @@ -25443,11 +24141,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -25571,16 +24273,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -25713,7 +24405,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -25727,7 +24418,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -25803,18 +24494,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -26110,7 +24802,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -26122,7 +24813,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -26148,7 +24839,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -26182,7 +24877,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -26351,99 +25046,77 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { + class TieredPackageConfig + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { - @JvmField val TIERED_PACKAGE = of("tiered_package") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun toBuilder() = Builder().from(this) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } + companion object { - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. + * Returns a mutable builder for constructing an instance of + * [TieredPackageConfig]. */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN + /** A builder for [TieredPackageConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { + additionalProperties = + tieredPackageConfig.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") + 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) + } + + /** + * Returns an immutable instance of [TieredPackageConfig]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): TieredPackageConfig = + TieredPackageConfig(additionalProperties.toImmutable()) + } + private var validated: Boolean = false - fun validate(): ModelType = apply { + fun validate(): TieredPackageConfig = apply { if (validated) { return@apply } - known() validated = true } @@ -26461,31 +25134,97 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + return /* spotless:off */ other is TieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "TieredPackageConfig{additionalProperties=$additionalProperties}" } - class TieredPackageConfig - @JsonCreator + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + class BillingCycleConfiguration private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + durationUnit: JsonField = JsonMissing.of(), + ) : this(duration, durationUnit, mutableMapOf()) + + /** + * The duration of the billing period. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun duration(): Long = duration.getRequired("duration") + + /** + * The unit of billing period duration. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** + * Returns the raw JSON value of [duration]. + * + * Unlike [duration], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** + * Returns the raw JSON value of [durationUnit]. + * + * Unlike [durationUnit], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -26493,227 +25232,58 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [TieredPackageConfig]. + * [BillingCycleConfiguration]. + * + * The following fields are required: + * ```java + * .duration() + * .durationUnit() + * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [TieredPackageConfig]. */ + /** A builder for [BillingCycleConfiguration]. */ class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { - additionalProperties = - tieredPackageConfig.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) - } - - /** - * Returns an immutable instance of [TieredPackageConfig]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): TieredPackageConfig = - TieredPackageConfig(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): TieredPackageConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> - !value.isNull() && !value.isMissing() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredPackageConfig && 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() = - "TieredPackageConfig{additionalProperties=$additionalProperties}" - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - class BillingCycleConfiguration - private constructor( - private val duration: JsonField, - private val durationUnit: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - durationUnit: JsonField = JsonMissing.of(), - ) : this(duration, durationUnit, mutableMapOf()) - - /** - * The duration of the billing period. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun duration(): Long = duration.getRequired("duration") - - /** - * The unit of billing period duration. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** - * Returns the raw JSON value of [duration]. - * - * Unlike [duration], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("duration") - @ExcludeMissing - fun _duration(): JsonField = duration - - /** - * Returns the raw JSON value of [durationUnit]. - * - * Unlike [durationUnit], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BillingCycleConfiguration]. - * - * The following fields are required: - * ```java - * .duration() - * .durationUnit() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** - * Sets [Builder.duration] to an arbitrary JSON value. - * - * You should usually call [Builder.duration] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** - * Sets [Builder.durationUnit] to an arbitrary JSON value. - * - * You should usually call [Builder.durationUnit] with a well-typed - * [DurationUnit] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** + * Sets [Builder.duration] to an arbitrary JSON value. + * + * You should usually call [Builder.duration] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** + * Sets [Builder.durationUnit] to an arbitrary JSON value. + * + * You should usually call [Builder.durationUnit] with a well-typed + * [DurationUnit] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } fun additionalProperties(additionalProperties: Map) = apply { @@ -27438,7 +26008,7 @@ private constructor( private val currency: JsonField, private val groupedTieredConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -27466,9 +26036,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -27553,11 +26121,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -27683,16 +26255,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -27816,7 +26378,6 @@ private constructor( * .currency() * .groupedTieredConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -27830,7 +26391,7 @@ private constructor( private var currency: JsonField? = null private var groupedTieredConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -27920,18 +26481,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -28213,7 +26775,6 @@ private constructor( * .currency() * .groupedTieredConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -28225,7 +26786,7 @@ private constructor( checkRequired("currency", currency), checkRequired("groupedTieredConfig", groupedTieredConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -28251,7 +26812,11 @@ private constructor( currency() groupedTieredConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -28285,7 +26850,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedTieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -28565,131 +27130,6 @@ private constructor( "GroupedTieredConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED = of("grouped_tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED -> Value.GROUPED_TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED -> Known.GROUPED_TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -29540,7 +27980,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -29569,9 +28009,7 @@ private constructor( @ExcludeMissing maxGroupTieredPackageConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -29656,11 +28094,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -29787,16 +28229,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -29920,7 +28352,6 @@ private constructor( * .currency() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -29935,7 +28366,7 @@ private constructor( private var itemId: JsonField? = null private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -30027,18 +28458,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -30320,7 +28752,6 @@ private constructor( * .currency() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -30332,7 +28763,7 @@ private constructor( checkRequired("currency", currency), checkRequired("itemId", itemId), checkRequired("maxGroupTieredPackageConfig", maxGroupTieredPackageConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -30358,7 +28789,11 @@ private constructor( currency() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -30392,7 +28827,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -30673,131 +29110,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -31647,7 +29959,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -31673,9 +29985,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_minimum_config") @ExcludeMissing @@ -31755,11 +30065,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -31883,16 +30197,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -32026,7 +30330,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -32040,7 +30343,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -32118,18 +30421,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -32424,7 +30728,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -32436,7 +30739,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -32462,7 +30765,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -32496,7 +30803,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -32665,131 +30972,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -33751,7 +31933,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -33777,9 +31959,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("package_with_allocation_config") @ExcludeMissing @@ -33860,11 +32040,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -33988,16 +32172,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -34131,7 +32305,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -34145,7 +32318,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = null @@ -34224,18 +32397,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -34531,7 +32705,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -34543,7 +32716,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageWithAllocationConfig", packageWithAllocationConfig), billableMetricId, @@ -34569,7 +32742,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -34603,7 +32780,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -34772,131 +32951,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -35859,7 +33913,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -35885,9 +33939,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_with_minimum_config") @ExcludeMissing @@ -35968,11 +34020,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -36096,16 +34152,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -36239,7 +34285,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageWithMinimumConfig() * ``` @@ -36253,7 +34298,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package_with_minimum") private var name: JsonField? = null private var tieredPackageWithMinimumConfig: JsonField? = @@ -36334,18 +34379,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_package_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -36641,7 +34687,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageWithMinimumConfig() * ``` @@ -36653,7 +34698,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "tieredPackageWithMinimumConfig", @@ -36682,7 +34727,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageWithMinimumConfig().validate() billableMetricId() @@ -36716,7 +34765,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_package_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -36885,131 +34936,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE_WITH_MINIMUM = of("tiered_package_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Value.TIERED_PACKAGE_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Known.TIERED_PACKAGE_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredPackageWithMinimumConfig @JsonCreator private constructor( @@ -37973,7 +35899,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -37999,9 +35925,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("unit_with_percent_config") @ExcludeMissing @@ -38081,11 +36005,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -38209,16 +36137,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -38351,7 +36269,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -38365,7 +36282,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -38442,18 +36359,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -38749,7 +36667,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -38761,7 +36678,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -38787,7 +36704,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -38821,7 +36742,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -38990,131 +36911,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -40076,7 +37872,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -40102,9 +37898,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_proration_config") @ExcludeMissing @@ -40184,11 +37978,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -40312,16 +38110,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -40455,7 +38243,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -40469,7 +38256,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -40547,18 +38334,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -40854,7 +38642,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -40866,7 +38653,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -40892,7 +38679,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -40926,7 +38717,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -41095,131 +38886,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -42182,7 +39848,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -42208,9 +39874,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("unit_with_proration_config") @ExcludeMissing @@ -42290,11 +39954,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -42418,16 +40086,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -42561,7 +40219,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -42575,7 +40232,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -42653,18 +40310,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -42959,7 +40617,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -42971,7 +40628,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -42997,7 +40654,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -43031,7 +40692,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -43200,131 +40861,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -44287,7 +41823,7 @@ private constructor( private val currency: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -44315,9 +41851,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -44402,11 +41936,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -44533,16 +42071,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -44666,7 +42194,6 @@ private constructor( * .currency() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -44680,7 +42207,7 @@ private constructor( private var currency: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -44771,18 +42298,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -45064,7 +42592,6 @@ private constructor( * .currency() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -45076,7 +42603,7 @@ private constructor( checkRequired("currency", currency), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -45102,7 +42629,11 @@ private constructor( currency() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -45136,7 +42667,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -45416,131 +42947,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -46392,7 +43798,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -46421,9 +43827,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -46508,11 +43912,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -46639,16 +44047,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -46772,7 +44170,6 @@ private constructor( * .currency() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -46788,7 +44185,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -46886,18 +44283,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -47179,7 +44577,6 @@ private constructor( * .currency() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -47194,7 +44591,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -47220,7 +44617,11 @@ private constructor( currency() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -47254,7 +44655,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -47536,132 +44939,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -48512,7 +45789,7 @@ private constructor( private val currency: JsonField, private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -48541,9 +45818,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -48628,11 +45903,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -48759,16 +46038,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -48892,7 +46161,6 @@ private constructor( * .currency() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -48908,7 +46176,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -49004,18 +46272,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -49297,7 +46566,6 @@ private constructor( * .currency() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -49312,7 +46580,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -49338,7 +46606,11 @@ private constructor( currency() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -49372,7 +46644,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -49654,131 +46928,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -50629,7 +47778,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -50658,9 +47807,7 @@ private constructor( @ExcludeMissing matrixWithDisplayNameConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -50745,11 +47892,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -50876,16 +48027,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -51009,7 +48150,6 @@ private constructor( * .currency() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -51024,7 +48164,7 @@ private constructor( private var itemId: JsonField? = null private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -51116,18 +48256,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -51409,7 +48550,6 @@ private constructor( * .currency() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -51421,7 +48561,7 @@ private constructor( checkRequired("currency", currency), checkRequired("itemId", itemId), checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -51447,7 +48587,11 @@ private constructor( currency() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -51481,7 +48625,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -51762,131 +48908,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -52737,7 +49758,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -52765,9 +49786,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -52852,11 +49871,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -52983,16 +50006,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -53116,7 +50129,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -53130,7 +50142,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -53221,18 +50233,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -53514,7 +50527,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -53526,7 +50538,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -53552,7 +50564,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -53586,7 +50602,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_with_proration")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -53866,131 +50882,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -54841,7 +51732,7 @@ private constructor( private val currency: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -54870,9 +51761,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -54957,11 +51846,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -55088,16 +51981,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -55221,7 +52104,6 @@ private constructor( * .currency() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -55236,7 +52118,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -55328,18 +52210,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -55621,7 +52504,6 @@ private constructor( * .currency() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -55633,7 +52515,7 @@ private constructor( checkRequired("currency", currency), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -55659,7 +52541,11 @@ private constructor( currency() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -55693,7 +52579,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -55974,131 +52860,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -56948,7 +53709,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -56975,9 +53736,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("scalable_matrix_with_unit_pricing_config") @ExcludeMissing @@ -57059,11 +53818,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -57189,16 +53952,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -57332,7 +54085,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -57346,7 +54098,8 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -57432,18 +54185,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -57745,7 +54499,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -57757,7 +54510,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -57786,7 +54539,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -57820,7 +54577,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -57989,132 +54748,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -59078,7 +55711,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -59105,9 +55738,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("scalable_matrix_with_tiered_pricing_config") @ExcludeMissing @@ -59189,11 +55820,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -59319,16 +55954,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -59463,7 +56088,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -59477,7 +56101,8 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -59565,18 +56190,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -59880,7 +56506,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -59892,7 +56517,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -59921,7 +56546,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -59955,7 +56584,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -60124,135 +56755,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -61218,7 +57720,7 @@ private constructor( private val cumulativeGroupedBulkConfig: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -61247,9 +57749,7 @@ private constructor( @JsonProperty("item_id") @ExcludeMissing itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("billable_metric_id") @ExcludeMissing @@ -61334,11 +57834,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -61465,16 +57969,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -61598,7 +58092,6 @@ private constructor( * .cumulativeGroupedBulkConfig() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -61613,7 +58106,7 @@ private constructor( null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -61705,18 +58198,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -61998,7 +58492,6 @@ private constructor( * .cumulativeGroupedBulkConfig() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -62010,7 +58503,7 @@ private constructor( checkRequired("cumulativeGroupedBulkConfig", cumulativeGroupedBulkConfig), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -62036,7 +58529,11 @@ private constructor( cumulativeGroupedBulkConfig().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -62070,7 +58567,9 @@ private constructor( (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -62351,131 +58850,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or months. */ 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 94fc2b50f..c8f173aa9 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 @@ -2167,7 +2167,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2181,7 +2181,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2216,11 +2216,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2276,16 +2282,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2355,7 +2351,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2370,7 +2365,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2407,17 +2402,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2559,7 +2556,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2572,7 +2568,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2592,7 +2588,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2618,143 +2620,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2776,7 +2650,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2790,7 +2664,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2825,11 +2699,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2885,16 +2765,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -2964,7 +2834,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -2979,7 +2848,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3016,17 +2885,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3168,7 +3039,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3181,7 +3051,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3201,7 +3071,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3227,143 +3103,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3385,7 +3133,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3399,7 +3147,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3434,11 +3182,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3495,16 +3249,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3574,7 +3318,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3589,7 +3332,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3628,17 +3371,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3780,7 +3525,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3793,7 +3537,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3813,7 +3557,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3839,143 +3589,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3997,7 +3619,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4012,7 +3634,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4051,11 +3673,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4120,16 +3748,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4207,7 +3825,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4223,7 +3840,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4261,17 +3878,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4425,7 +4044,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4439,7 +4057,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4460,7 +4078,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4487,7 +4111,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4495,147 +4119,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4646,7 +4140,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4660,7 +4154,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4695,11 +4189,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4755,16 +4255,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4834,7 +4324,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4849,7 +4338,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4885,17 +4374,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5037,7 +4528,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5050,7 +4540,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5070,7 +4560,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5096,143 +4592,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5738,7 +5104,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5757,7 +5123,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5804,11 +5170,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5857,16 +5229,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5909,7 +5271,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5923,7 +5284,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6014,17 +5375,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6089,7 +5452,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6105,7 +5467,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6122,7 +5484,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6147,137 +5513,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6300,7 +5539,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6317,7 +5556,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6358,11 +5597,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6410,16 +5655,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6471,7 +5706,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6485,7 +5719,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6564,17 +5798,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6655,7 +5891,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6671,7 +5906,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6688,7 +5923,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6713,138 +5952,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6867,7 +5979,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6884,7 +5996,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6925,11 +6037,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6978,16 +6096,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7039,7 +6147,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7053,7 +6160,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7129,17 +6236,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7221,7 +6330,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7237,7 +6345,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7254,7 +6362,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7279,138 +6391,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 b1147de00..dc39560ce 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 @@ -2209,7 +2209,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2223,7 +2223,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2258,11 +2258,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2318,16 +2324,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2397,7 +2393,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2412,7 +2407,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2449,17 +2444,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2601,7 +2598,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2614,7 +2610,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2634,7 +2630,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2660,143 +2662,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2818,7 +2692,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2832,7 +2706,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2867,11 +2741,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2927,16 +2807,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3006,7 +2876,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3021,7 +2890,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3058,17 +2927,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3210,7 +3081,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3223,7 +3093,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3243,7 +3113,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3269,143 +3145,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3427,7 +3175,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3441,7 +3189,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3476,11 +3224,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3537,16 +3291,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3616,7 +3360,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3631,7 +3374,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3670,17 +3413,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3822,7 +3567,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3835,7 +3579,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3855,7 +3599,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3881,143 +3631,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4039,7 +3661,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4054,7 +3676,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4093,11 +3715,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4162,16 +3790,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4249,7 +3867,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4265,7 +3882,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4303,17 +3920,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4467,7 +4086,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4481,7 +4099,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4502,7 +4120,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4529,7 +4153,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4537,147 +4161,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4688,7 +4182,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4702,7 +4196,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4737,11 +4231,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4797,16 +4297,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4876,7 +4366,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4891,7 +4380,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4927,17 +4416,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5079,7 +4570,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5092,7 +4582,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5112,7 +4602,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5138,143 +4634,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5780,7 +5146,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5799,7 +5165,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5846,11 +5212,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5899,16 +5271,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5951,7 +5313,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5965,7 +5326,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6056,17 +5417,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6131,7 +5494,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6147,7 +5509,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6164,7 +5526,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6189,137 +5555,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6342,7 +5581,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6359,7 +5598,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6400,11 +5639,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6452,16 +5697,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6513,7 +5748,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6527,7 +5761,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6606,17 +5840,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6697,7 +5933,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6713,7 +5948,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6730,7 +5965,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6755,138 +5994,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6909,7 +6021,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6926,7 +6038,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6967,11 +6079,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7020,16 +6138,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7081,7 +6189,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7095,7 +6202,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7171,17 +6278,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7263,7 +6372,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7279,7 +6387,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7296,7 +6404,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7321,138 +6433,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt index 4943568ed..4a5b03c21 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt @@ -2751,7 +2751,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2767,7 +2767,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2802,12 +2802,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2864,16 +2869,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2945,7 +2940,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2960,7 +2954,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2998,17 +2992,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3151,7 +3147,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -3164,7 +3159,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3184,7 +3179,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -3210,144 +3211,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3369,7 +3241,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -3385,7 +3257,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -3420,12 +3292,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a @@ -3482,16 +3359,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3563,7 +3430,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3578,7 +3444,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3617,17 +3483,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3770,7 +3638,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3783,7 +3650,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3803,7 +3670,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3829,144 +3702,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3988,7 +3732,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -4004,7 +3748,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4039,12 +3783,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4102,16 +3851,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4183,7 +3922,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -4198,7 +3936,8 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = + JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -4239,17 +3978,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4392,7 +4133,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -4405,7 +4145,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4425,7 +4165,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -4451,144 +4197,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4610,7 +4227,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4627,7 +4244,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4666,12 +4283,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4737,16 +4359,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4828,7 +4440,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4844,7 +4455,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4883,17 +4494,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5048,7 +4661,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -5062,7 +4674,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5083,7 +4695,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -5110,7 +4728,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -5118,141 +4736,10 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ } @@ -5270,7 +4757,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -5286,7 +4773,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -5321,12 +4808,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -5383,16 +4875,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -5464,7 +4946,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5479,7 +4960,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -5516,17 +4997,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5669,7 +5152,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5682,7 +5164,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5702,7 +5184,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5728,144 +5216,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6381,7 +5738,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -6400,7 +5757,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6447,11 +5804,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6501,16 +5864,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6554,7 +5907,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6568,7 +5920,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6662,17 +6014,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6739,7 +6093,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6754,7 +6107,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6771,7 +6124,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6796,140 +6153,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6952,7 +6179,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6969,7 +6196,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -7010,11 +6237,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7064,16 +6297,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7126,7 +6349,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -7140,7 +6362,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -7223,17 +6445,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7317,7 +6541,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -7332,7 +6555,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -7349,7 +6572,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -7374,141 +6601,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7531,7 +6628,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -7548,7 +6645,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -7589,11 +6686,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7643,16 +6746,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7705,7 +6798,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7719,7 +6811,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7799,17 +6891,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7893,7 +6987,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7908,7 +7001,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7925,7 +7018,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7950,141 +7047,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt index 8706a8497..1cce17ea5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt @@ -2751,7 +2751,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2767,7 +2767,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2802,12 +2802,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2864,16 +2869,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2945,7 +2940,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2960,7 +2954,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2998,17 +2992,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3151,7 +3147,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -3164,7 +3159,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3184,7 +3179,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -3210,144 +3211,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3369,7 +3241,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -3385,7 +3257,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -3420,12 +3292,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a @@ -3482,16 +3359,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3563,7 +3430,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3578,7 +3444,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3617,17 +3483,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3770,7 +3638,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3783,7 +3650,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3803,7 +3670,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3829,144 +3702,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3988,7 +3732,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -4004,7 +3748,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4039,12 +3783,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4102,16 +3851,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4183,7 +3922,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -4198,7 +3936,8 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = + JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -4239,17 +3978,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4392,7 +4133,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -4405,7 +4145,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4425,7 +4165,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -4451,144 +4197,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4610,7 +4227,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4627,7 +4244,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4666,12 +4283,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4737,16 +4359,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4828,7 +4440,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4844,7 +4455,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4883,17 +4494,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5048,7 +4661,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -5062,7 +4674,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5083,7 +4695,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -5110,7 +4728,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -5118,141 +4736,10 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ } @@ -5270,7 +4757,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -5286,7 +4773,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -5321,12 +4808,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -5383,16 +4875,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -5464,7 +4946,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5479,7 +4960,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -5516,17 +4997,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5669,7 +5152,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5682,7 +5164,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5702,7 +5184,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5728,144 +5216,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6381,7 +5738,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -6400,7 +5757,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6447,11 +5804,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6501,16 +5864,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6554,7 +5907,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6568,7 +5920,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6662,17 +6014,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6739,7 +6093,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6754,7 +6107,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6771,7 +6124,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6796,140 +6153,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6952,7 +6179,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6969,7 +6196,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -7010,11 +6237,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7064,16 +6297,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7126,7 +6349,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -7140,7 +6362,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -7223,17 +6445,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7317,7 +6541,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -7332,7 +6555,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -7349,7 +6572,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -7374,141 +6601,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7531,7 +6628,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -7548,7 +6645,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -7589,11 +6686,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7643,16 +6746,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7705,7 +6798,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7719,7 +6811,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7799,17 +6891,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7893,7 +6987,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7908,7 +7001,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7925,7 +7018,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7950,141 +7047,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt index 41b9fa0ba..19dcc39e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt @@ -2751,7 +2751,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2767,7 +2767,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2802,12 +2802,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2864,16 +2869,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2945,7 +2940,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2960,7 +2954,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2998,17 +2992,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3151,7 +3147,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -3164,7 +3159,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3184,7 +3179,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -3210,144 +3211,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3369,7 +3241,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -3385,7 +3257,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -3420,12 +3292,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a @@ -3482,16 +3359,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3563,7 +3430,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3578,7 +3444,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3617,17 +3483,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3770,7 +3638,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3783,7 +3650,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3803,7 +3670,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3829,144 +3702,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3988,7 +3732,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -4004,7 +3748,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4039,12 +3783,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4102,16 +3851,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4183,7 +3922,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -4198,7 +3936,8 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = + JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -4239,17 +3978,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4392,7 +4133,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -4405,7 +4145,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4425,7 +4165,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -4451,144 +4197,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4610,7 +4227,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4627,7 +4244,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4666,12 +4283,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4737,16 +4359,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4828,7 +4440,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4844,7 +4455,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4883,17 +4494,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5048,7 +4661,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -5062,7 +4674,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5083,7 +4695,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -5110,7 +4728,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -5118,141 +4736,10 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ } @@ -5270,7 +4757,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -5286,7 +4773,7 @@ private constructor( id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -5321,12 +4808,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the + * server responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = - adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -5383,16 +4875,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -5464,7 +4946,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5479,7 +4960,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -5516,17 +4997,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults + * to the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5669,7 +5152,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5682,7 +5164,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5702,7 +5184,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5728,144 +5216,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> - throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6381,7 +5738,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -6400,7 +5757,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6447,11 +5804,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6501,16 +5864,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6554,7 +5907,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6568,7 +5920,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6662,17 +6014,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6739,7 +6093,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6754,7 +6107,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6771,7 +6124,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6796,140 +6153,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6952,7 +6179,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6969,7 +6196,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -7010,11 +6237,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7064,16 +6297,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7126,7 +6349,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -7140,7 +6362,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -7223,17 +6445,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7317,7 +6541,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -7332,7 +6555,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -7349,7 +6572,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -7374,141 +6601,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7531,7 +6628,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -7548,7 +6645,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -7589,11 +6686,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7643,16 +6746,6 @@ private constructor( fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7705,7 +6798,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7719,7 +6811,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7799,17 +6891,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7893,7 +6987,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7908,7 +7001,7 @@ private constructor( }, checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds) .map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7925,7 +7018,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7950,141 +7047,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 61e514f4d..dd5093955 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 @@ -4166,7 +4166,7 @@ private constructor( class NewPercentageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val percentageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -4177,7 +4177,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4196,11 +4196,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -4230,16 +4236,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4290,7 +4286,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -4301,7 +4296,7 @@ private constructor( /** A builder for [NewPercentageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var percentageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -4318,17 +4313,19 @@ private constructor( newPercentageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4420,7 +4417,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -4429,7 +4425,7 @@ private constructor( */ fun build(): NewPercentageDiscount = NewPercentageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4446,7 +4442,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() percentageDiscount() isInvoiceLevel() @@ -4469,141 +4471,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4624,7 +4498,7 @@ private constructor( class NewUsageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val usageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -4635,7 +4509,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4654,11 +4528,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -4687,16 +4567,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4746,7 +4616,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -4757,7 +4626,7 @@ private constructor( /** A builder for [NewUsageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var usageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -4773,17 +4642,19 @@ private constructor( additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4875,7 +4746,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -4884,7 +4754,7 @@ private constructor( */ fun build(): NewUsageDiscount = NewUsageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4901,7 +4771,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() usageDiscount() isInvoiceLevel() @@ -4924,141 +4800,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5079,7 +4825,7 @@ private constructor( class NewAmountDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -5090,7 +4836,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -5109,11 +4855,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -5142,16 +4894,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -5202,7 +4944,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -5213,7 +4954,7 @@ private constructor( /** A builder for [NewAmountDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -5229,17 +4970,19 @@ private constructor( additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5331,7 +5074,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -5340,7 +5082,7 @@ private constructor( */ fun build(): NewAmountDiscount = NewAmountDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5357,7 +5099,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -5380,141 +5128,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5535,7 +5153,7 @@ private constructor( class NewMinimum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val itemId: JsonField, private val minimumAmount: JsonField, @@ -5547,7 +5165,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -5570,11 +5188,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -5612,16 +5236,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -5679,7 +5293,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -5691,7 +5304,7 @@ private constructor( /** A builder for [NewMinimum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var itemId: JsonField? = null private var minimumAmount: JsonField? = null @@ -5708,17 +5321,19 @@ private constructor( additionalProperties = newMinimum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5822,7 +5437,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -5832,7 +5446,7 @@ private constructor( */ fun build(): NewMinimum = NewMinimum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5850,7 +5464,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() itemId() minimumAmount() @@ -5874,142 +5494,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6030,7 +5520,7 @@ private constructor( class NewMaximum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val maximumAmount: JsonField, private val isInvoiceLevel: JsonField, @@ -6041,7 +5531,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -6060,11 +5550,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -6093,16 +5589,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -6152,7 +5638,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -6163,7 +5648,7 @@ private constructor( /** A builder for [NewMaximum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var maximumAmount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -6178,17 +5663,19 @@ private constructor( additionalProperties = newMaximum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -6280,7 +5767,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -6289,7 +5775,7 @@ private constructor( */ fun build(): NewMaximum = NewMaximum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6306,7 +5792,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() maximumAmount() isInvoiceLevel() @@ -6329,141 +5821,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9612,7 +8974,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -9639,7 +9001,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -9720,11 +9082,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -9865,16 +9231,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -10027,7 +9383,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -10040,7 +9395,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -10107,18 +9462,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -10460,7 +9816,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -10471,7 +9826,7 @@ private constructor( NewSubscriptionUnitPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -10498,7 +9853,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -10533,7 +9892,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -10707,135 +10066,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -11862,7 +11092,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -11889,7 +11119,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -11970,11 +11200,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -12115,16 +11349,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -12277,7 +11501,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -12290,7 +11513,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -12358,18 +11581,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -12712,7 +11936,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -12723,7 +11946,7 @@ private constructor( NewSubscriptionPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -12750,7 +11973,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -12785,7 +12012,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -12959,135 +12186,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -14166,7 +13264,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -14195,7 +13293,7 @@ private constructor( matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -14280,11 +13378,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -14428,16 +13530,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -14581,7 +13673,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -14594,7 +13685,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -14675,18 +13766,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -15016,7 +14108,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -15027,7 +14118,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -15054,7 +14145,11 @@ private constructor( cadence().validate() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -15089,7 +14184,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -15807,135 +14902,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -16791,7 +15757,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -16818,7 +15784,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -16899,11 +15865,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -17044,16 +16014,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -17206,7 +16166,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -17219,7 +16178,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -17287,18 +16246,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -17641,7 +16601,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -17652,7 +16611,7 @@ private constructor( NewSubscriptionTieredPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -17679,7 +16638,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -17714,7 +16677,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -17888,135 +16851,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -19335,7 +18169,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -19362,7 +18196,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -19443,11 +18277,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -19589,16 +18427,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -19751,7 +18579,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -19764,7 +18591,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -19833,18 +18660,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -20187,7 +19015,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -20198,7 +19025,7 @@ private constructor( NewSubscriptionTieredBpsPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -20225,7 +19052,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -20260,7 +19091,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -20434,135 +19265,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -21924,7 +20626,7 @@ private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -21953,7 +20655,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -22038,11 +20740,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -22186,16 +20892,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -22339,7 +21035,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -22352,7 +21047,7 @@ private constructor( private var bpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -22431,18 +21126,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -22772,7 +21468,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -22783,7 +21478,7 @@ private constructor( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -22810,7 +21505,11 @@ private constructor( bpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -22845,7 +21544,7 @@ private constructor( (bpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -23236,135 +21935,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -24221,7 +22791,7 @@ private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -24250,7 +22820,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -24335,11 +22905,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -24483,16 +23057,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -24636,7 +23200,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -24649,7 +23212,7 @@ private constructor( private var bulkBpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -24730,18 +23293,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -25071,7 +23635,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -25082,7 +23645,7 @@ private constructor( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -25109,7 +23672,11 @@ private constructor( bulkBpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -25144,7 +23711,7 @@ private constructor( (bulkBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -25776,135 +24343,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -26761,7 +25199,7 @@ private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -26790,7 +25228,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -26875,11 +25313,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -27023,16 +25465,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -27176,7 +25608,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -27189,7 +25620,7 @@ private constructor( private var bulkConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -27268,18 +25699,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -27609,7 +26041,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -27620,7 +26051,7 @@ private constructor( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -27647,7 +26078,11 @@ private constructor( bulkConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -27682,7 +26117,7 @@ private constructor( (bulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -28272,135 +26707,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -29256,7 +27562,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -29283,7 +27589,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -29365,11 +27671,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -29511,16 +27821,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -29674,7 +27974,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -29687,7 +27986,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -29762,18 +28061,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -30118,7 +28418,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -30129,7 +28428,7 @@ private constructor( NewSubscriptionThresholdTotalAmountPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -30156,7 +28455,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -30191,7 +28494,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("threshold_total_amount")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -30365,135 +28670,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ThresholdTotalAmountConfig @JsonCreator private constructor( @@ -31463,7 +29639,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -31490,7 +29666,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -31571,11 +29747,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -31717,16 +29897,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -31879,7 +30049,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -31892,7 +30061,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -31961,18 +30130,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -32316,7 +30486,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -32327,7 +30496,7 @@ private constructor( NewSubscriptionTieredPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -32354,7 +30523,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -32389,7 +30562,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -32563,102 +30736,78 @@ private constructor( override fun toString() = value.toString() } - class ModelType + class TieredPackageConfig @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ + private constructor( @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { + private val additionalProperties: Map + ) { - @JvmField val TIERED_PACKAGE = of("tiered_package") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun toBuilder() = Builder().from(this) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } + companion object { - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. + * Returns a mutable builder for constructing an instance of + * [TieredPackageConfig]. */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN + /** A builder for [TieredPackageConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { + additionalProperties = + tieredPackageConfig.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") + 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) } + /** + * Returns an immutable instance of [TieredPackageConfig]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): TieredPackageConfig = + TieredPackageConfig(additionalProperties.toImmutable()) + } + private var validated: Boolean = false - fun validate(): ModelType = apply { + fun validate(): TieredPackageConfig = apply { if (validated) { return@apply } - known() validated = true } @@ -32677,31 +30826,97 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + return /* spotless:off */ other is TieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "TieredPackageConfig{additionalProperties=$additionalProperties}" } - class TieredPackageConfig - @JsonCreator + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + class BillingCycleConfiguration private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + durationUnit: JsonField = JsonMissing.of(), + ) : this(duration, durationUnit, mutableMapOf()) + + /** + * The duration of the billing period. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun duration(): Long = duration.getRequired("duration") + + /** + * The unit of billing period duration. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** + * Returns the raw JSON value of [duration]. + * + * Unlike [duration], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** + * Returns the raw JSON value of [durationUnit]. + * + * Unlike [durationUnit], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -32709,230 +30924,59 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [TieredPackageConfig]. + * [BillingCycleConfiguration]. + * + * The following fields are required: + * ```java + * .duration() + * .durationUnit() + * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [TieredPackageConfig]. */ + /** A builder for [BillingCycleConfiguration]. */ class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { - additionalProperties = - tieredPackageConfig.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) - } - - /** - * Returns an immutable instance of [TieredPackageConfig]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): TieredPackageConfig = - TieredPackageConfig(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): TieredPackageConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> - !value.isNull() && !value.isMissing() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredPackageConfig && 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() = - "TieredPackageConfig{additionalProperties=$additionalProperties}" - } - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - class BillingCycleConfiguration - private constructor( - private val duration: JsonField, - private val durationUnit: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - durationUnit: JsonField = JsonMissing.of(), - ) : this(duration, durationUnit, mutableMapOf()) - - /** - * The duration of the billing period. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun duration(): Long = duration.getRequired("duration") - - /** - * The unit of billing period duration. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** - * Returns the raw JSON value of [duration]. - * - * Unlike [duration], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("duration") - @ExcludeMissing - fun _duration(): JsonField = duration - - /** - * Returns the raw JSON value of [durationUnit]. - * - * Unlike [durationUnit], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BillingCycleConfiguration]. - * - * The following fields are required: - * ```java - * .duration() - * .durationUnit() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** - * Sets [Builder.duration] to an arbitrary JSON value. - * - * You should usually call [Builder.duration] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** - * Sets [Builder.durationUnit] to an arbitrary JSON value. - * - * You should usually call [Builder.durationUnit] with a well-typed - * [DurationUnit] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** + * Sets [Builder.duration] to an arbitrary JSON value. + * + * You should usually call [Builder.duration] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** + * Sets [Builder.durationUnit] to an arbitrary JSON value. + * + * You should usually call [Builder.durationUnit] with a well-typed + * [DurationUnit] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } fun additionalProperties(additionalProperties: Map) = @@ -33660,7 +31704,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -33687,7 +31731,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -33768,11 +31812,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -33914,16 +31962,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -34077,7 +32115,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -34090,7 +32127,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -34163,18 +32200,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -34517,7 +32555,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -34528,7 +32565,7 @@ private constructor( NewSubscriptionTieredWithMinimumPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -34555,7 +32592,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -34590,7 +32631,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -34764,135 +32807,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -35862,7 +33776,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -35889,7 +33803,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -35970,11 +33884,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -36116,16 +34034,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -36279,7 +34187,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -36292,7 +34199,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -36362,18 +34269,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -36716,7 +34624,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -36727,7 +34634,7 @@ private constructor( NewSubscriptionUnitWithPercentPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -36754,7 +34661,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -36789,7 +34700,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -36963,135 +34874,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -38060,7 +35842,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -38087,7 +35869,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -38169,11 +35951,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -38315,16 +36101,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -38478,7 +36254,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -38491,7 +36266,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = @@ -38568,18 +36343,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -38924,7 +36700,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -38935,7 +36710,7 @@ private constructor( NewSubscriptionPackageWithAllocationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "packageWithAllocationConfig", @@ -38965,7 +36740,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -39000,7 +36779,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -39174,135 +36955,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -40273,7 +37925,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -40300,7 +37952,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -40382,11 +38034,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -40528,16 +38184,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -40691,7 +38337,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -40704,7 +38349,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null @@ -40778,18 +38423,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -41133,7 +38779,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -41144,7 +38789,7 @@ private constructor( NewSubscriptionTierWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -41171,7 +38816,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -41206,7 +38855,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -41380,135 +39031,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -42478,7 +40000,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -42505,7 +40027,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -42586,11 +40108,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -42732,16 +40258,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -42895,7 +40411,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -42908,7 +40423,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -42981,18 +40496,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -43335,7 +40851,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -43346,7 +40861,7 @@ private constructor( NewSubscriptionUnitWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -43373,7 +40888,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -43408,7 +40927,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("unit_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -43582,135 +41103,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -44681,7 +42073,7 @@ private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -44710,7 +42102,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -44796,11 +42188,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -44945,16 +42341,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -45098,7 +42484,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -45111,7 +42496,7 @@ private constructor( private var cadence: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -45197,18 +42582,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -45538,7 +42924,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -45549,7 +42934,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -45576,7 +42961,11 @@ private constructor( cadence().validate() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -45611,7 +43000,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -45898,135 +43287,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -46884,7 +44144,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -46914,7 +44174,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -47002,11 +44262,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -47151,16 +44415,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -47304,7 +44558,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -47319,7 +44572,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -47420,18 +44674,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -47762,7 +45017,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -47776,7 +45030,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -47803,7 +45057,11 @@ private constructor( cadence().validate() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -47838,7 +45096,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -48126,136 +45386,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -49112,7 +46242,7 @@ private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -49141,7 +46271,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -49227,11 +46357,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -49376,16 +46510,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -49529,7 +46653,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -49542,7 +46665,7 @@ private constructor( private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -49628,18 +46751,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -49969,7 +47093,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -49980,7 +47103,7 @@ private constructor( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -50007,7 +47130,11 @@ private constructor( bulkWithProrationConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -50042,7 +47169,9 @@ private constructor( (bulkWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("bulk_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -50329,135 +47458,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -51313,7 +48313,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -51341,7 +48341,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -51424,11 +48424,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -51572,16 +48576,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -51736,7 +48730,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -51749,7 +48742,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -51832,18 +48826,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -52197,7 +49192,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -52208,7 +49202,7 @@ private constructor( NewSubscriptionScalableMatrixWithUnitPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -52238,7 +49232,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -52273,7 +49271,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -52448,139 +49448,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = - of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -53552,7 +50419,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -53580,7 +50447,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -53663,11 +50530,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -53811,16 +50682,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -53975,7 +50836,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -53988,7 +50848,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -54072,18 +50933,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -54437,7 +51299,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -54448,7 +51309,7 @@ private constructor( NewSubscriptionScalableMatrixWithTieredPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -54478,7 +51339,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -54513,7 +51378,10 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 + else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -54688,139 +51556,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -55796,7 +52531,7 @@ private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -55826,7 +52561,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -55912,11 +52647,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -56061,16 +52800,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -56214,7 +52943,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -56229,7 +52957,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -56319,18 +53047,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -56660,7 +53389,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -56674,7 +53402,7 @@ private constructor( cumulativeGroupedBulkConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -56701,7 +53429,11 @@ private constructor( cadence().validate() cumulativeGroupedBulkConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -56736,7 +53468,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -57024,135 +53758,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -58009,7 +54614,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -58039,7 +54644,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -58125,11 +54730,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -58274,16 +54883,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -58427,7 +55026,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -58442,7 +55040,7 @@ private constructor( private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -58532,18 +55130,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -58873,7 +55472,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -58887,7 +55485,7 @@ private constructor( "maxGroupTieredPackageConfig", maxGroupTieredPackageConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -58914,7 +55512,11 @@ private constructor( cadence().validate() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -58949,7 +55551,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -59237,135 +55841,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -60223,7 +56698,7 @@ private constructor( private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -60253,7 +56728,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -60341,11 +56816,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -60490,16 +56969,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -60643,7 +57112,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -60658,7 +57126,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -60758,18 +57227,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -61100,7 +57570,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -61114,7 +57583,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -61141,7 +57610,11 @@ private constructor( cadence().validate() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -61176,7 +57649,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -61464,136 +57939,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -62450,7 +58795,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -62480,7 +58825,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -62566,11 +58911,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -62715,16 +59064,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -62868,7 +59207,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -62883,7 +59221,7 @@ private constructor( private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -62973,18 +59311,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -63314,7 +59653,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -63328,7 +59666,7 @@ private constructor( "matrixWithDisplayNameConfig", matrixWithDisplayNameConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -63355,7 +59693,11 @@ private constructor( cadence().validate() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -63390,7 +59732,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -63678,135 +60022,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -64663,7 +60878,7 @@ private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -64693,7 +60908,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -64779,11 +60994,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -64928,16 +61147,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -65081,7 +61290,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -65095,7 +61303,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -65184,18 +61392,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -65525,7 +61734,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -65536,7 +61744,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -65563,7 +61771,11 @@ private constructor( cadence().validate() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -65598,7 +61810,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -65885,135 +62099,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -68242,7 +64327,7 @@ private constructor( class NewPercentageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val percentageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -68253,7 +64338,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -68272,11 +64357,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -68306,16 +64397,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -68366,7 +64447,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -68377,7 +64457,7 @@ private constructor( /** A builder for [NewPercentageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var percentageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -68394,17 +64474,19 @@ private constructor( newPercentageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -68496,7 +64578,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -68505,7 +64586,7 @@ private constructor( */ fun build(): NewPercentageDiscount = NewPercentageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -68522,7 +64603,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() percentageDiscount() isInvoiceLevel() @@ -68545,141 +64632,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -68700,7 +64659,7 @@ private constructor( class NewUsageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val usageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -68711,7 +64670,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -68730,11 +64689,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -68763,16 +64728,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -68822,7 +64777,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -68833,7 +64787,7 @@ private constructor( /** A builder for [NewUsageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var usageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -68849,17 +64803,19 @@ private constructor( additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -68951,7 +64907,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -68960,7 +64915,7 @@ private constructor( */ fun build(): NewUsageDiscount = NewUsageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -68977,7 +64932,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() usageDiscount() isInvoiceLevel() @@ -69000,141 +64961,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -69155,7 +64986,7 @@ private constructor( class NewAmountDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -69166,7 +64997,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -69185,11 +65016,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -69218,16 +65055,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -69278,7 +65105,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -69289,7 +65115,7 @@ private constructor( /** A builder for [NewAmountDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -69305,17 +65131,19 @@ private constructor( additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -69407,7 +65235,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -69416,7 +65243,7 @@ private constructor( */ fun build(): NewAmountDiscount = NewAmountDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -69433,7 +65260,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -69456,141 +65289,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -69611,7 +65314,7 @@ private constructor( class NewMinimum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val itemId: JsonField, private val minimumAmount: JsonField, @@ -69623,7 +65326,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -69646,11 +65349,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -69688,16 +65397,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -69755,7 +65454,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -69767,7 +65465,7 @@ private constructor( /** A builder for [NewMinimum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var itemId: JsonField? = null private var minimumAmount: JsonField? = null @@ -69784,17 +65482,19 @@ private constructor( additionalProperties = newMinimum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -69898,7 +65598,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -69908,7 +65607,7 @@ private constructor( */ fun build(): NewMinimum = NewMinimum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -69926,7 +65625,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() itemId() minimumAmount() @@ -69950,142 +65655,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -70106,7 +65681,7 @@ private constructor( class NewMaximum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val maximumAmount: JsonField, private val isInvoiceLevel: JsonField, @@ -70117,7 +65692,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -70136,11 +65711,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -70169,16 +65750,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -70228,7 +65799,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -70239,7 +65809,7 @@ private constructor( /** A builder for [NewMaximum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var maximumAmount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -70254,17 +65824,19 @@ private constructor( additionalProperties = newMaximum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -70356,7 +65928,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -70365,7 +65936,7 @@ private constructor( */ fun build(): NewMaximum = NewMaximum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -70382,7 +65953,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() maximumAmount() isInvoiceLevel() @@ -70405,141 +65982,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -73656,7 +69103,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -73683,7 +69130,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -73764,11 +69211,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -73909,16 +69360,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -74071,7 +69512,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -74084,7 +69524,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -74151,18 +69591,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -74504,7 +69945,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -74515,7 +69955,7 @@ private constructor( NewSubscriptionUnitPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -74542,7 +69982,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -74577,7 +70021,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -74751,135 +70195,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -75906,7 +71221,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -75933,7 +71248,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -76014,11 +71329,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -76159,16 +71478,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -76321,7 +71630,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -76334,7 +71642,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -76402,18 +71710,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -76756,7 +72065,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -76767,7 +72075,7 @@ private constructor( NewSubscriptionPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -76794,7 +72102,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -76829,7 +72141,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -77003,135 +72315,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -78210,7 +73393,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -78239,7 +73422,7 @@ private constructor( matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -78324,11 +73507,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -78472,16 +73659,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -78625,7 +73802,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -78638,7 +73814,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -78719,18 +73895,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -79060,7 +74237,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -79071,7 +74247,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -79098,7 +74274,11 @@ private constructor( cadence().validate() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -79133,7 +74313,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -79851,135 +75031,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -80835,7 +75886,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -80862,7 +75913,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -80943,11 +75994,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -81088,16 +76143,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -81250,7 +76295,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -81263,7 +76307,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -81331,18 +76375,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -81685,7 +76730,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -81696,7 +76740,7 @@ private constructor( NewSubscriptionTieredPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -81723,7 +76767,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -81758,7 +76806,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -81932,135 +76980,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -83379,7 +78298,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -83406,7 +78325,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -83487,11 +78406,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -83633,16 +78556,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -83795,7 +78708,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -83808,7 +78720,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -83877,18 +78789,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -84231,7 +79144,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -84242,7 +79154,7 @@ private constructor( NewSubscriptionTieredBpsPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -84269,7 +79181,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -84304,7 +79220,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -84478,135 +79394,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -85968,7 +80755,7 @@ private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -85997,7 +80784,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -86082,11 +80869,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -86230,16 +81021,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -86383,7 +81164,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -86396,7 +81176,7 @@ private constructor( private var bpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -86475,18 +81255,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -86816,7 +81597,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -86827,7 +81607,7 @@ private constructor( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -86854,7 +81634,11 @@ private constructor( bpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -86889,7 +81673,7 @@ private constructor( (bpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -87280,135 +82064,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -88265,7 +82920,7 @@ private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -88294,7 +82949,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -88379,11 +83034,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -88527,16 +83186,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -88680,7 +83329,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -88693,7 +83341,7 @@ private constructor( private var bulkBpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -88774,18 +83422,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -89115,7 +83764,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -89126,7 +83774,7 @@ private constructor( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -89153,7 +83801,11 @@ private constructor( bulkBpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -89188,7 +83840,7 @@ private constructor( (bulkBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -89820,135 +84472,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -90805,7 +85328,7 @@ private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -90834,7 +85357,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -90919,11 +85442,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -91067,16 +85594,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -91220,7 +85737,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -91233,7 +85749,7 @@ private constructor( private var bulkConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -91312,18 +85828,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -91653,7 +86170,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -91664,7 +86180,7 @@ private constructor( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -91691,7 +86207,11 @@ private constructor( bulkConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -91726,7 +86246,7 @@ private constructor( (bulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -92316,135 +86836,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -93300,7 +87691,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -93327,7 +87718,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -93409,11 +87800,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -93555,16 +87950,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -93718,7 +88103,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -93731,7 +88115,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -93806,18 +88190,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -94162,7 +88547,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -94173,7 +88557,7 @@ private constructor( NewSubscriptionThresholdTotalAmountPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -94200,7 +88584,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -94235,7 +88623,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("threshold_total_amount")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -94409,135 +88799,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ThresholdTotalAmountConfig @JsonCreator private constructor( @@ -95507,7 +89768,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -95534,7 +89795,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -95615,11 +89876,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -95761,16 +90026,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -95923,7 +90178,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -95936,7 +90190,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -96005,18 +90259,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -96360,7 +90615,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -96371,7 +90625,7 @@ private constructor( NewSubscriptionTieredPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -96398,7 +90652,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -96433,7 +90691,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -96607,135 +90865,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE = of("tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredPackageConfig @JsonCreator private constructor( @@ -97704,7 +91833,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -97731,7 +91860,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -97812,11 +91941,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -97958,16 +92091,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -98121,7 +92244,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -98134,7 +92256,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -98207,18 +92329,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -98561,7 +92684,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -98572,7 +92694,7 @@ private constructor( NewSubscriptionTieredWithMinimumPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -98599,7 +92721,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -98634,7 +92760,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -98808,135 +92936,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -99906,7 +93905,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -99933,7 +93932,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -100014,11 +94013,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -100160,16 +94163,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -100323,7 +94316,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -100336,7 +94328,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -100406,18 +94398,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -100760,7 +94753,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -100771,7 +94763,7 @@ private constructor( NewSubscriptionUnitWithPercentPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -100798,7 +94790,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -100833,7 +94829,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -101007,135 +95003,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -102104,7 +95971,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -102131,7 +95998,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -102213,11 +96080,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -102359,16 +96230,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -102522,7 +96383,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -102535,7 +96395,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = @@ -102612,18 +96472,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -102968,7 +96829,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -102979,7 +96839,7 @@ private constructor( NewSubscriptionPackageWithAllocationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "packageWithAllocationConfig", @@ -103009,7 +96869,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -103044,7 +96908,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -103218,135 +97084,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -104317,7 +98054,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -104344,7 +98081,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -104426,11 +98163,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -104572,16 +98313,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -104735,7 +98466,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -104748,7 +98478,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null @@ -104822,18 +98552,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -105177,7 +98908,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -105188,7 +98918,7 @@ private constructor( NewSubscriptionTierWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -105215,7 +98945,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -105250,7 +98984,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -105424,135 +99160,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -106522,7 +100129,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -106549,7 +100156,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -106630,11 +100237,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -106776,16 +100387,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -106939,7 +100540,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -106952,7 +100552,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -107025,18 +100625,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -107379,7 +100980,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -107390,7 +100990,7 @@ private constructor( NewSubscriptionUnitWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -107417,7 +101017,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -107452,7 +101056,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("unit_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -107626,135 +101232,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -108725,7 +102202,7 @@ private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -108754,7 +102231,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -108840,11 +102317,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -108989,16 +102470,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -109142,7 +102613,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -109155,7 +102625,7 @@ private constructor( private var cadence: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -109241,18 +102711,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -109582,7 +103053,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -109593,7 +103063,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -109620,7 +103090,11 @@ private constructor( cadence().validate() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -109655,7 +103129,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -109942,135 +103416,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -110928,7 +104273,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -110958,7 +104303,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -111046,11 +104391,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -111195,16 +104544,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -111348,7 +104687,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -111363,7 +104701,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -111464,18 +104803,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -111806,7 +105146,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -111820,7 +105159,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -111847,7 +105186,11 @@ private constructor( cadence().validate() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -111882,7 +105225,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -112170,136 +105515,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -113156,7 +106371,7 @@ private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -113185,7 +106400,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -113271,11 +106486,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -113420,16 +106639,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -113573,7 +106782,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -113586,7 +106794,7 @@ private constructor( private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -113672,18 +106880,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -114013,7 +107222,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -114024,7 +107232,7 @@ private constructor( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -114051,7 +107259,11 @@ private constructor( bulkWithProrationConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -114086,7 +107298,9 @@ private constructor( (bulkWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("bulk_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -114373,135 +107587,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -115357,7 +108442,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -115385,7 +108470,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -115468,11 +108553,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -115616,16 +108705,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -115780,7 +108859,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -115793,7 +108871,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -115876,18 +108955,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -116241,7 +109321,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -116252,7 +109331,7 @@ private constructor( NewSubscriptionScalableMatrixWithUnitPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -116282,7 +109361,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -116317,7 +109400,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -116492,139 +109577,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = - of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -117596,7 +110548,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -117624,7 +110576,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -117707,11 +110659,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -117855,16 +110811,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -118019,7 +110965,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -118032,7 +110977,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -118116,18 +111062,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -118481,7 +111428,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -118492,7 +111438,7 @@ private constructor( NewSubscriptionScalableMatrixWithTieredPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -118522,7 +111468,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -118557,7 +111507,10 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 + else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -118732,139 +111685,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -119840,7 +112660,7 @@ private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -119870,7 +112690,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -119956,11 +112776,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -120105,16 +112929,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -120258,7 +113072,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -120273,7 +113086,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -120363,18 +113176,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -120704,7 +113518,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -120718,7 +113531,7 @@ private constructor( cumulativeGroupedBulkConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -120745,7 +113558,11 @@ private constructor( cadence().validate() cumulativeGroupedBulkConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -120780,7 +113597,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -121068,135 +113887,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -122053,7 +114743,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -122083,7 +114773,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -122169,11 +114859,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -122318,16 +115012,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -122471,7 +115155,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -122486,7 +115169,7 @@ private constructor( private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -122576,18 +115259,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -122917,7 +115601,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -122931,7 +115614,7 @@ private constructor( "maxGroupTieredPackageConfig", maxGroupTieredPackageConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -122958,7 +115641,11 @@ private constructor( cadence().validate() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -122993,7 +115680,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -123281,135 +115970,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -124267,7 +116827,7 @@ private constructor( private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -124297,7 +116857,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -124385,11 +116945,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -124534,16 +117098,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -124687,7 +117241,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -124702,7 +117255,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -124802,18 +117356,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -125144,7 +117699,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -125158,7 +117712,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -125185,7 +117739,11 @@ private constructor( cadence().validate() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -125220,7 +117778,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -125508,136 +118068,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -126494,7 +118924,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -126524,7 +118954,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -126610,11 +119040,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -126759,16 +119193,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -126912,7 +119336,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -126927,7 +119350,7 @@ private constructor( private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -127017,18 +119440,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -127358,7 +119782,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -127372,7 +119795,7 @@ private constructor( "matrixWithDisplayNameConfig", matrixWithDisplayNameConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -127399,7 +119822,11 @@ private constructor( cadence().validate() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -127434,7 +119861,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -127722,135 +120151,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -128707,7 +121007,7 @@ private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -128737,7 +121037,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -128823,11 +121123,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -128972,16 +121276,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -129125,7 +121419,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -129139,7 +121432,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -129228,18 +121521,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -129569,7 +121863,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -129580,7 +121873,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -129607,7 +121900,11 @@ private constructor( cadence().validate() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -129642,7 +121939,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -129929,135 +122228,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. 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 fc804d4ce..a3081ba95 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 @@ -2209,7 +2209,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2223,7 +2223,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2258,11 +2258,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2318,16 +2324,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2397,7 +2393,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2412,7 +2407,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2449,17 +2444,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2601,7 +2598,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2614,7 +2610,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2634,7 +2630,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2660,143 +2662,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2818,7 +2692,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2832,7 +2706,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2867,11 +2741,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2927,16 +2807,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3006,7 +2876,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3021,7 +2890,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3058,17 +2927,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3210,7 +3081,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3223,7 +3093,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3243,7 +3113,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3269,143 +3145,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3427,7 +3175,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3441,7 +3189,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3476,11 +3224,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3537,16 +3291,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3616,7 +3360,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3631,7 +3374,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3670,17 +3413,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3822,7 +3567,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3835,7 +3579,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3855,7 +3599,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3881,143 +3631,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4039,7 +3661,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4054,7 +3676,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4093,11 +3715,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4162,16 +3790,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4249,7 +3867,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4265,7 +3882,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4303,17 +3920,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4467,7 +4086,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4481,7 +4099,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4502,7 +4120,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4529,7 +4153,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4537,147 +4161,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4688,7 +4182,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4702,7 +4196,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4737,11 +4231,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4797,16 +4297,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4876,7 +4366,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4891,7 +4380,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4927,17 +4416,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5079,7 +4570,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5092,7 +4582,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5112,7 +4602,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5138,143 +4634,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5780,7 +5146,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5799,7 +5165,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5846,11 +5212,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5899,16 +5271,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5951,7 +5313,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5965,7 +5326,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6056,17 +5417,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6131,7 +5494,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6147,7 +5509,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6164,7 +5526,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6189,137 +5555,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6342,7 +5581,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6359,7 +5598,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6400,11 +5639,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6452,16 +5697,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6513,7 +5748,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6527,7 +5761,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6606,17 +5840,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6697,7 +5933,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6713,7 +5948,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6730,7 +5965,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6755,138 +5994,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6909,7 +6021,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6926,7 +6038,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6967,11 +6079,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7020,16 +6138,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7081,7 +6189,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7095,7 +6202,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7171,17 +6278,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7263,7 +6372,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7279,7 +6387,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7296,7 +6404,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7321,138 +6433,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 923ad5f95..648dc3c5b 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 @@ -1330,7 +1330,6 @@ private constructor( * Alias for calling [addDiscount] with the following: * ```java * Discount.AmountDiscountCreationParams.builder() - * .discountType(SubscriptionPriceIntervalsParams.Add.Discount.AmountDiscountCreationParams.DiscountType.AMOUNT) * .amountDiscount(amountDiscount) * .build() * ``` @@ -1338,12 +1337,6 @@ private constructor( fun addAmountDiscountCreationParamsDiscount(amountDiscount: Double) = addDiscount( Discount.AmountDiscountCreationParams.builder() - .discountType( - SubscriptionPriceIntervalsParams.Add.Discount - .AmountDiscountCreationParams - .DiscountType - .AMOUNT - ) .amountDiscount(amountDiscount) .build() ) @@ -1363,7 +1356,6 @@ private constructor( * Alias for calling [addDiscount] with the following: * ```java * Discount.PercentageDiscountCreationParams.builder() - * .discountType(SubscriptionPriceIntervalsParams.Add.Discount.PercentageDiscountCreationParams.DiscountType.PERCENTAGE) * .percentageDiscount(percentageDiscount) * .build() * ``` @@ -1371,12 +1363,6 @@ private constructor( fun addPercentageDiscountCreationParamsDiscount(percentageDiscount: Double) = addDiscount( Discount.PercentageDiscountCreationParams.builder() - .discountType( - SubscriptionPriceIntervalsParams.Add.Discount - .PercentageDiscountCreationParams - .DiscountType - .PERCENTAGE - ) .percentageDiscount(percentageDiscount) .build() ) @@ -1392,7 +1378,6 @@ private constructor( * Alias for calling [addDiscount] with the following: * ```java * Discount.UsageDiscountCreationParams.builder() - * .discountType(SubscriptionPriceIntervalsParams.Add.Discount.UsageDiscountCreationParams.DiscountType.USAGE) * .usageDiscount(usageDiscount) * .build() * ``` @@ -1400,12 +1385,6 @@ private constructor( fun addUsageDiscountCreationParamsDiscount(usageDiscount: Double) = addDiscount( Discount.UsageDiscountCreationParams.builder() - .discountType( - SubscriptionPriceIntervalsParams.Add.Discount - .UsageDiscountCreationParams - .DiscountType - .USAGE - ) .usageDiscount(usageDiscount) .build() ) @@ -2851,7 +2830,7 @@ private constructor( class AmountDiscountCreationParams private constructor( private val amountDiscount: JsonField, - private val discountType: JsonField, + private val discountType: JsonValue, private val additionalProperties: MutableMap, ) { @@ -2862,7 +2841,7 @@ private constructor( amountDiscount: JsonField = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), ) : this(amountDiscount, discountType, mutableMapOf()) /** @@ -2875,11 +2854,17 @@ private constructor( fun amountDiscount(): Double = amountDiscount.getRequired("amount_discount") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * Returns the raw JSON value of [amountDiscount]. @@ -2891,16 +2876,6 @@ private constructor( @ExcludeMissing fun _amountDiscount(): JsonField = amountDiscount - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -2922,7 +2897,6 @@ private constructor( * The following fields are required: * ```java * .amountDiscount() - * .discountType() * ``` */ @JvmStatic fun builder() = Builder() @@ -2932,7 +2906,7 @@ private constructor( class Builder internal constructor() { private var amountDiscount: JsonField? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2959,17 +2933,19 @@ private constructor( this.amountDiscount = amountDiscount } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -3003,7 +2979,6 @@ private constructor( * The following fields are required: * ```java * .amountDiscount() - * .discountType() * ``` * * @throws IllegalStateException if any required field is unset. @@ -3011,7 +2986,7 @@ private constructor( fun build(): AmountDiscountCreationParams = AmountDiscountCreationParams( checkRequired("amountDiscount", amountDiscount), - checkRequired("discountType", discountType), + discountType, additionalProperties.toMutableMap(), ) } @@ -3024,7 +2999,11 @@ private constructor( } amountDiscount() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } validated = true } @@ -3045,137 +3024,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amountDiscount.asKnown().isPresent) 1 else 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) - - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } override fun equals(other: Any?): Boolean { if (this === other) { @@ -3197,7 +3046,7 @@ private constructor( class PercentageDiscountCreationParams private constructor( - private val discountType: JsonField, + private val discountType: JsonValue, private val percentageDiscount: JsonField, private val additionalProperties: MutableMap, ) { @@ -3206,18 +3055,24 @@ private constructor( private constructor( @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing percentageDiscount: JsonField = JsonMissing.of(), ) : this(discountType, percentageDiscount, mutableMapOf()) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * Only available if discount_type is `percentage`. This is a number between 0 @@ -3230,16 +3085,6 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [percentageDiscount]. * @@ -3270,7 +3115,6 @@ private constructor( * * The following fields are required: * ```java - * .discountType() * .percentageDiscount() * ``` */ @@ -3280,7 +3124,7 @@ private constructor( /** A builder for [PercentageDiscountCreationParams]. */ class Builder internal constructor() { - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var percentageDiscount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -3294,17 +3138,19 @@ private constructor( percentageDiscountCreationParams.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -3355,7 +3201,6 @@ private constructor( * * The following fields are required: * ```java - * .discountType() * .percentageDiscount() * ``` * @@ -3363,7 +3208,7 @@ private constructor( */ fun build(): PercentageDiscountCreationParams = PercentageDiscountCreationParams( - checkRequired("discountType", discountType), + discountType, checkRequired("percentageDiscount", percentageDiscount), additionalProperties.toMutableMap(), ) @@ -3376,7 +3221,11 @@ private constructor( return@apply } - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } percentageDiscount() validated = true } @@ -3397,139 +3246,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (percentageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3550,7 +3269,7 @@ private constructor( class UsageDiscountCreationParams private constructor( - private val discountType: JsonField, + private val discountType: JsonValue, private val usageDiscount: JsonField, private val additionalProperties: MutableMap, ) { @@ -3559,18 +3278,24 @@ private constructor( private constructor( @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing usageDiscount: JsonField = JsonMissing.of(), ) : this(discountType, usageDiscount, mutableMapOf()) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * Only available if discount_type is `usage`. Number of usage units that this @@ -3582,16 +3307,6 @@ private constructor( */ fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [usageDiscount]. * @@ -3622,7 +3337,6 @@ private constructor( * * The following fields are required: * ```java - * .discountType() * .usageDiscount() * ``` */ @@ -3632,7 +3346,7 @@ private constructor( /** A builder for [UsageDiscountCreationParams]. */ class Builder internal constructor() { - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var usageDiscount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -3645,17 +3359,19 @@ private constructor( usageDiscountCreationParams.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed - * [DiscountType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -3706,7 +3422,6 @@ private constructor( * * The following fields are required: * ```java - * .discountType() * .usageDiscount() * ``` * @@ -3714,7 +3429,7 @@ private constructor( */ fun build(): UsageDiscountCreationParams = UsageDiscountCreationParams( - checkRequired("discountType", discountType), + discountType, checkRequired("usageDiscount", usageDiscount), additionalProperties.toMutableMap(), ) @@ -3727,7 +3442,11 @@ private constructor( return@apply } - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } usageDiscount() validated = true } @@ -3748,139 +3467,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5648,7 +5237,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -5676,7 +5265,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -5759,11 +5348,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -5896,16 +5489,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -6039,7 +5622,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -6053,7 +5635,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -6128,18 +5710,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -6442,7 +6025,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -6454,7 +6036,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -6480,7 +6062,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -6514,7 +6100,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -6686,135 +6272,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -7842,7 +7299,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -7870,7 +7327,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -7953,11 +7410,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -8090,16 +7551,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -8233,7 +7684,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -8247,7 +7697,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -8323,18 +7773,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -8638,7 +8089,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -8650,7 +8100,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -8676,7 +8126,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -8710,7 +8164,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -8882,135 +8336,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -10090,7 +9415,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -10120,7 +9445,7 @@ private constructor( matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -10207,11 +9532,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -10347,16 +9676,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -10481,7 +9800,6 @@ private constructor( * .currency() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -10495,7 +9813,7 @@ private constructor( private var currency: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -10583,18 +9901,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -10885,7 +10204,6 @@ private constructor( * .currency() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -10897,7 +10215,7 @@ private constructor( checkRequired("currency", currency), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -10923,7 +10241,11 @@ private constructor( currency() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -10957,7 +10279,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -11673,135 +10995,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -12659,7 +11852,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val matrixWithAllocationConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -12690,7 +11883,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -12778,11 +11971,15 @@ private constructor( matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -12919,16 +12116,6 @@ private constructor( fun _matrixWithAllocationConfig(): JsonField = matrixWithAllocationConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -13053,7 +12240,6 @@ private constructor( * .currency() * .itemId() * .matrixWithAllocationConfig() - * .modelType() * .name() * ``` */ @@ -13068,7 +12254,7 @@ private constructor( private var itemId: JsonField? = null private var matrixWithAllocationConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -13162,18 +12348,19 @@ private constructor( matrixWithAllocationConfig: JsonField ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -13464,7 +12651,6 @@ private constructor( * .currency() * .itemId() * .matrixWithAllocationConfig() - * .modelType() * .name() * ``` * @@ -13476,7 +12662,7 @@ private constructor( checkRequired("currency", currency), checkRequired("itemId", itemId), checkRequired("matrixWithAllocationConfig", matrixWithAllocationConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -13502,7 +12688,11 @@ private constructor( currency() itemId() matrixWithAllocationConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -13536,7 +12726,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -14309,135 +13501,6 @@ private constructor( "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -15294,7 +14357,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -15322,7 +14385,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -15405,11 +14468,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -15542,16 +14609,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -15685,7 +14742,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -15699,7 +14755,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -15774,18 +14830,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -16089,7 +15146,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -16101,7 +15157,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -16127,7 +15183,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -16161,7 +15221,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -16333,135 +15393,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -17781,7 +16712,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -17809,7 +16740,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -17892,11 +16823,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -18030,16 +16965,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -18173,7 +17098,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -18187,7 +17111,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -18264,18 +17188,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -18579,7 +17504,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -18591,7 +17515,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -18617,7 +17541,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -18651,7 +17579,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -18823,135 +17751,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -20314,7 +19113,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -20344,7 +19143,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -20431,11 +19230,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -20571,16 +19374,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -20705,7 +19498,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -20719,7 +19511,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -20806,18 +19598,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -21108,7 +19901,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -21120,7 +19912,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -21146,7 +19938,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -21180,7 +19976,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -21569,135 +20365,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -22555,7 +21222,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -22585,7 +21252,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -22672,11 +21339,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -22812,16 +21483,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -22946,7 +21607,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -22960,7 +21620,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -23049,18 +21709,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -23351,7 +22012,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -23363,7 +22023,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -23389,7 +22049,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -23423,7 +22087,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -24053,135 +22717,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -25039,7 +23574,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -25069,7 +23604,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -25156,11 +23691,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -25296,16 +23835,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -25430,7 +23959,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -25444,7 +23972,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -25531,18 +24059,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -25833,7 +24362,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -25845,7 +24373,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -25871,7 +24399,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -25905,7 +24437,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -26493,135 +25025,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -27478,7 +25881,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -27506,7 +25909,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -27590,11 +25993,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -27728,16 +26135,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -27872,7 +26269,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -27886,7 +26282,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -27966,18 +26362,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -28283,7 +26680,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -28295,7 +26691,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -28321,7 +26717,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -28355,7 +26755,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("threshold_total_amount")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -28527,135 +26929,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ThresholdTotalAmountConfig @JsonCreator private constructor( @@ -29626,7 +27899,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -29654,7 +27927,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -29737,11 +28010,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -29875,16 +28152,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -30018,7 +28285,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -30032,7 +28298,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -30110,18 +28376,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -30426,7 +28693,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -30438,7 +28704,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -30464,7 +28730,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -30498,7 +28768,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -30670,135 +28940,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE = of("tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredPackageConfig @JsonCreator private constructor( @@ -31769,7 +29910,7 @@ private constructor( private val currency: JsonField, private val groupedTieredConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -31799,7 +29940,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -31887,11 +30028,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -32027,16 +30172,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -32161,7 +30296,6 @@ private constructor( * .currency() * .groupedTieredConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -32175,7 +30309,7 @@ private constructor( private var currency: JsonField? = null private var groupedTieredConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -32267,18 +30401,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -32569,7 +30704,6 @@ private constructor( * .currency() * .groupedTieredConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -32581,7 +30715,7 @@ private constructor( checkRequired("currency", currency), checkRequired("groupedTieredConfig", groupedTieredConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -32607,7 +30741,11 @@ private constructor( currency() groupedTieredConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -32641,7 +30779,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedTieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -32925,135 +31063,6 @@ private constructor( "GroupedTieredConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED = of("grouped_tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED -> Value.GROUPED_TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED -> Known.GROUPED_TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -33911,7 +31920,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -33942,7 +31951,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -34030,11 +32039,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -34171,16 +32184,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -34305,7 +32308,6 @@ private constructor( * .currency() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -34321,7 +32323,7 @@ private constructor( private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -34418,18 +32420,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -34720,7 +32723,6 @@ private constructor( * .currency() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -34735,7 +32737,7 @@ private constructor( "maxGroupTieredPackageConfig", maxGroupTieredPackageConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -34761,7 +32763,11 @@ private constructor( currency() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -34795,7 +32801,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -35081,135 +33089,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -36066,7 +33945,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -36094,7 +33973,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -36177,11 +34056,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -36315,16 +34198,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -36459,7 +34332,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -36473,7 +34345,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -36552,18 +34424,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -36867,7 +34740,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -36879,7 +34751,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -36905,7 +34777,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -36939,7 +34815,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -37111,135 +34989,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -38210,7 +35959,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -38238,7 +35987,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -38322,11 +36071,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -38460,16 +36213,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -38604,7 +36347,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -38618,7 +36360,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = @@ -38702,18 +36444,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -39019,7 +36762,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -39031,7 +36773,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "packageWithAllocationConfig", @@ -39060,7 +36802,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -39094,7 +36840,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -39266,135 +37014,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -40366,7 +37985,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageWithMinimumConfig: JsonField, @@ -40395,7 +38014,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -40479,11 +38098,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -40617,16 +38240,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -40761,7 +38374,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageWithMinimumConfig() * ``` @@ -40775,7 +38387,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package_with_minimum") private var name: JsonField? = null private var tieredPackageWithMinimumConfig: JsonField? = @@ -40860,18 +38472,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_package_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -41179,7 +38792,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredPackageWithMinimumConfig() * ``` @@ -41191,7 +38803,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "tieredPackageWithMinimumConfig", @@ -41220,7 +38832,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageWithMinimumConfig().validate() billableMetricId() @@ -41254,7 +38870,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_package_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -41426,136 +39044,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val TIERED_PACKAGE_WITH_MINIMUM = of("tiered_package_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Value.TIERED_PACKAGE_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Known.TIERED_PACKAGE_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredPackageWithMinimumConfig @JsonCreator private constructor( @@ -42527,7 +40015,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -42555,7 +40043,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -42638,11 +40126,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -42776,16 +40268,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -42920,7 +40402,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -42934,7 +40415,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -43013,18 +40494,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -43328,7 +40810,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -43340,7 +40821,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -43366,7 +40847,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -43400,7 +40885,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -43572,135 +41057,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -44670,7 +42026,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -44698,7 +42054,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -44782,11 +42138,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -44920,16 +42280,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -45064,7 +42414,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -45078,7 +42427,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null @@ -45158,18 +42507,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -45474,7 +42824,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -45486,7 +42835,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -45512,7 +42861,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -45546,7 +42899,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -45718,135 +43073,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -46817,7 +44043,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -46845,7 +44071,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -46928,11 +44154,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -47066,16 +44296,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -47210,7 +44430,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -47224,7 +44443,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -47303,18 +44522,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -47618,7 +44838,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -47630,7 +44849,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -47656,7 +44875,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -47690,7 +44913,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("unit_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -47862,135 +45087,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -48962,7 +46058,7 @@ private constructor( private val currency: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -48992,7 +46088,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -49080,11 +46176,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -49221,16 +46321,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -49355,7 +46445,6 @@ private constructor( * .currency() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -49369,7 +46458,7 @@ private constructor( private var currency: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -49461,18 +46550,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -49763,7 +46853,6 @@ private constructor( * .currency() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -49775,7 +46864,7 @@ private constructor( checkRequired("currency", currency), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -49801,7 +46890,11 @@ private constructor( currency() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -49835,7 +46928,7 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -50120,135 +47213,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -51107,7 +48071,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -51138,7 +48102,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -51228,11 +48192,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -51369,16 +48337,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -51503,7 +48461,6 @@ private constructor( * .currency() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -51519,7 +48476,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -51625,18 +48583,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -51928,7 +48887,6 @@ private constructor( * .currency() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -51943,7 +48901,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -51969,7 +48927,11 @@ private constructor( currency() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -52003,7 +48965,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -52289,136 +49253,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -53277,7 +50111,7 @@ private constructor( private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -53308,7 +50142,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -53398,11 +50232,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -53539,16 +50377,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -53673,7 +50501,6 @@ private constructor( * .currency() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -53689,7 +50516,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -53794,18 +50622,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -54096,7 +50925,6 @@ private constructor( * .currency() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -54111,7 +50939,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -54137,7 +50965,11 @@ private constructor( currency() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -54171,7 +51003,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -54457,136 +51291,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -55444,7 +52148,7 @@ private constructor( private val currency: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -55475,7 +52179,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -55563,11 +52267,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -55704,16 +52412,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -55838,7 +52536,6 @@ private constructor( * .currency() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -55854,7 +52551,7 @@ private constructor( private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -55951,18 +52648,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -56253,7 +52951,6 @@ private constructor( * .currency() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -56268,7 +52965,7 @@ private constructor( "matrixWithDisplayNameConfig", matrixWithDisplayNameConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -56294,7 +52991,11 @@ private constructor( currency() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -56328,7 +53029,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -56614,135 +53317,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -57600,7 +54174,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -57630,7 +54204,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -57718,11 +54292,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -57859,16 +54437,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -57993,7 +54561,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -58007,7 +54574,7 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -58099,18 +54666,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -58401,7 +54969,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -58413,7 +54980,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -58439,7 +55006,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -58473,7 +55044,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("bulk_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -58758,135 +55331,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -59744,7 +56188,7 @@ private constructor( private val currency: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -59775,7 +56219,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -59863,11 +56307,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -60004,16 +56452,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -60138,7 +56576,6 @@ private constructor( * .currency() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -60153,7 +56590,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -60247,18 +56684,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -60549,7 +56987,6 @@ private constructor( * .currency() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -60561,7 +56998,7 @@ private constructor( checkRequired("currency", currency), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -60587,7 +57024,11 @@ private constructor( currency() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -60621,7 +57062,9 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -60906,135 +57349,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -61891,7 +58205,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -61920,7 +58234,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -62005,11 +58319,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -62145,16 +58463,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -62290,7 +58598,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -62304,7 +58611,8 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -62395,18 +58703,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -62721,7 +59030,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -62733,7 +59041,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -62762,7 +59070,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -62796,7 +59108,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -62969,139 +59283,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = - of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -64074,7 +60255,7 @@ private constructor( private val cadence: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -64103,7 +60284,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -64188,11 +60369,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -64328,16 +60513,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -64473,7 +60648,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -64487,7 +60661,8 @@ private constructor( private var cadence: JsonField? = null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -64579,18 +60754,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -64905,7 +61081,6 @@ private constructor( * .cadence() * .currency() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -64917,7 +61092,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -64946,7 +61121,11 @@ private constructor( cadence().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -64980,7 +61159,10 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 + else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -65153,139 +61335,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -66262,7 +62311,7 @@ private constructor( private val cumulativeGroupedBulkConfig: JsonField, private val currency: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -66293,7 +62342,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -66381,11 +62430,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -66522,16 +62575,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -66656,7 +62699,6 @@ private constructor( * .cumulativeGroupedBulkConfig() * .currency() * .itemId() - * .modelType() * .name() * ``` */ @@ -66672,7 +62714,7 @@ private constructor( null private var currency: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -66769,18 +62811,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -67071,7 +63114,6 @@ private constructor( * .cumulativeGroupedBulkConfig() * .currency() * .itemId() - * .modelType() * .name() * ``` * @@ -67086,7 +63128,7 @@ private constructor( ), checkRequired("currency", currency), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -67112,7 +63154,11 @@ private constructor( cumulativeGroupedBulkConfig().validate() currency() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -67146,7 +63192,9 @@ private constructor( (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -67432,135 +63480,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -68991,7 +64910,7 @@ private constructor( class NewPercentageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val percentageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -69002,7 +64921,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -69021,11 +64940,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -69055,16 +64980,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -69115,7 +65030,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -69126,7 +65040,7 @@ private constructor( /** A builder for [NewPercentageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var percentageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -69143,17 +65057,19 @@ private constructor( newPercentageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -69245,7 +65161,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -69254,7 +65169,7 @@ private constructor( */ fun build(): NewPercentageDiscount = NewPercentageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -69271,7 +65186,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() percentageDiscount() isInvoiceLevel() @@ -69294,141 +65215,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -69449,7 +65242,7 @@ private constructor( class NewUsageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val usageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -69460,7 +65253,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -69479,11 +65272,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -69512,16 +65311,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -69571,7 +65360,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -69582,7 +65370,7 @@ private constructor( /** A builder for [NewUsageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var usageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -69598,17 +65386,19 @@ private constructor( additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -69700,7 +65490,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -69709,7 +65498,7 @@ private constructor( */ fun build(): NewUsageDiscount = NewUsageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -69726,7 +65515,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() usageDiscount() isInvoiceLevel() @@ -69749,141 +65544,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -69904,7 +65569,7 @@ private constructor( class NewAmountDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -69915,7 +65580,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -69934,11 +65599,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -69967,16 +65638,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -70027,7 +65688,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -70038,7 +65698,7 @@ private constructor( /** A builder for [NewAmountDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -70054,17 +65714,19 @@ private constructor( additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -70156,7 +65818,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -70165,7 +65826,7 @@ private constructor( */ fun build(): NewAmountDiscount = NewAmountDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -70182,7 +65843,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -70205,141 +65872,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -70360,7 +65897,7 @@ private constructor( class NewMinimum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val itemId: JsonField, private val minimumAmount: JsonField, @@ -70372,7 +65909,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -70395,11 +65932,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -70437,16 +65980,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -70504,7 +66037,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -70516,7 +66048,7 @@ private constructor( /** A builder for [NewMinimum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var itemId: JsonField? = null private var minimumAmount: JsonField? = null @@ -70533,17 +66065,19 @@ private constructor( additionalProperties = newMinimum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -70647,7 +66181,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -70657,7 +66190,7 @@ private constructor( */ fun build(): NewMinimum = NewMinimum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -70675,7 +66208,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() itemId() minimumAmount() @@ -70699,142 +66238,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -70855,7 +66264,7 @@ private constructor( class NewMaximum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val maximumAmount: JsonField, private val isInvoiceLevel: JsonField, @@ -70866,7 +66275,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -70885,11 +66294,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -70918,16 +66333,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -70977,7 +66382,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -70988,7 +66392,7 @@ private constructor( /** A builder for [NewMaximum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var maximumAmount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -71003,17 +66407,19 @@ private constructor( additionalProperties = newMaximum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -71105,7 +66511,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -71114,7 +66519,7 @@ private constructor( */ fun build(): NewMaximum = NewMaximum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -71131,7 +66536,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() maximumAmount() isInvoiceLevel() @@ -71154,141 +66565,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 795bbc128..eaca322ab 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 @@ -2220,7 +2220,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2234,7 +2234,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2269,11 +2269,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2329,16 +2335,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2408,7 +2404,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2423,7 +2418,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2460,17 +2455,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2612,7 +2609,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2625,7 +2621,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2645,7 +2641,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2671,143 +2673,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2829,7 +2703,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2843,7 +2717,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2878,11 +2752,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2938,16 +2818,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3017,7 +2887,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3032,7 +2901,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3069,17 +2938,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3221,7 +3092,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3234,7 +3104,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3254,7 +3124,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3280,143 +3156,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3438,7 +3186,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3452,7 +3200,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3487,11 +3235,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3548,16 +3302,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3627,7 +3371,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3642,7 +3385,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3681,17 +3424,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3833,7 +3578,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3846,7 +3590,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3866,7 +3610,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3892,143 +3642,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4050,7 +3672,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4065,7 +3687,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4104,11 +3726,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4173,16 +3801,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4260,7 +3878,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4276,7 +3893,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4314,17 +3931,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4478,7 +4097,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4492,7 +4110,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4513,7 +4131,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4540,7 +4164,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4548,147 +4172,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4699,7 +4193,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4713,7 +4207,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4748,11 +4242,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4808,16 +4308,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4887,7 +4377,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4902,7 +4391,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4938,17 +4427,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5090,7 +4581,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5103,7 +4593,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5123,7 +4613,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5149,143 +4645,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5791,7 +5157,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5810,7 +5176,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5857,11 +5223,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5910,16 +5282,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5962,7 +5324,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5976,7 +5337,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6067,17 +5428,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6142,7 +5505,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6158,7 +5520,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6175,7 +5537,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6200,137 +5566,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6353,7 +5592,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6370,7 +5609,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6411,11 +5650,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6463,16 +5708,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6524,7 +5759,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6538,7 +5772,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6617,17 +5851,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6708,7 +5944,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6724,7 +5959,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6741,7 +5976,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6766,138 +6005,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6920,7 +6032,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6937,7 +6049,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6978,11 +6090,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7031,16 +6149,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7092,7 +6200,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7106,7 +6213,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7182,17 +6289,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7274,7 +6383,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7290,7 +6398,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7307,7 +6415,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7332,138 +6444,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 851d01511..e39ea22bd 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 @@ -3933,7 +3933,7 @@ private constructor( class NewPercentageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val percentageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -3944,7 +3944,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3963,11 +3963,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -3997,16 +4003,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4057,7 +4053,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -4068,7 +4063,7 @@ private constructor( /** A builder for [NewPercentageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var percentageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -4085,17 +4080,19 @@ private constructor( newPercentageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4187,7 +4184,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -4196,7 +4192,7 @@ private constructor( */ fun build(): NewPercentageDiscount = NewPercentageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4213,7 +4209,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() percentageDiscount() isInvoiceLevel() @@ -4236,141 +4238,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4391,7 +4265,7 @@ private constructor( class NewUsageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val usageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -4402,7 +4276,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4421,11 +4295,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -4454,16 +4334,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4513,7 +4383,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -4524,7 +4393,7 @@ private constructor( /** A builder for [NewUsageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var usageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -4540,17 +4409,19 @@ private constructor( additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4642,7 +4513,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -4651,7 +4521,7 @@ private constructor( */ fun build(): NewUsageDiscount = NewUsageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4668,7 +4538,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() usageDiscount() isInvoiceLevel() @@ -4691,141 +4567,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4846,7 +4592,7 @@ private constructor( class NewAmountDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -4857,7 +4603,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -4876,11 +4622,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -4909,16 +4661,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -4969,7 +4711,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -4980,7 +4721,7 @@ private constructor( /** A builder for [NewAmountDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -4996,17 +4737,19 @@ private constructor( additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5098,7 +4841,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -5107,7 +4849,7 @@ private constructor( */ fun build(): NewAmountDiscount = NewAmountDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5124,7 +4866,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -5147,141 +4895,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5302,7 +4920,7 @@ private constructor( class NewMinimum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val itemId: JsonField, private val minimumAmount: JsonField, @@ -5314,7 +4932,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -5337,11 +4955,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -5379,16 +5003,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -5446,7 +5060,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -5458,7 +5071,7 @@ private constructor( /** A builder for [NewMinimum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var itemId: JsonField? = null private var minimumAmount: JsonField? = null @@ -5475,17 +5088,19 @@ private constructor( additionalProperties = newMinimum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5589,7 +5204,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -5599,7 +5213,7 @@ private constructor( */ fun build(): NewMinimum = NewMinimum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5617,7 +5231,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() itemId() minimumAmount() @@ -5641,142 +5261,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5797,7 +5287,7 @@ private constructor( class NewMaximum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val maximumAmount: JsonField, private val isInvoiceLevel: JsonField, @@ -5808,7 +5298,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -5827,11 +5317,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -5860,16 +5356,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -5919,7 +5405,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -5930,7 +5415,7 @@ private constructor( /** A builder for [NewMaximum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var maximumAmount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -5945,17 +5430,19 @@ private constructor( additionalProperties = newMaximum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -6047,7 +5534,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -6056,7 +5542,7 @@ private constructor( */ fun build(): NewMaximum = NewMaximum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6073,7 +5559,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() maximumAmount() isInvoiceLevel() @@ -6096,141 +5588,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9379,7 +8741,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -9406,7 +8768,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -9487,11 +8849,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -9632,16 +8998,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -9794,7 +9150,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -9807,7 +9162,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -9874,18 +9229,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -10227,7 +9583,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -10238,7 +9593,7 @@ private constructor( NewSubscriptionUnitPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -10265,7 +9620,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -10300,7 +9659,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -10474,135 +9833,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -11629,7 +10859,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -11656,7 +10886,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -11737,11 +10967,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -11882,16 +11116,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -12044,7 +11268,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -12057,7 +11280,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -12125,18 +11348,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -12479,7 +11703,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -12490,7 +11713,7 @@ private constructor( NewSubscriptionPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -12517,7 +11740,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -12552,7 +11779,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -12726,135 +11953,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -13933,7 +13031,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -13962,7 +13060,7 @@ private constructor( matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -14047,11 +13145,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -14195,16 +13297,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -14348,7 +13440,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -14361,7 +13452,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -14442,18 +13533,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -14783,7 +13875,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -14794,7 +13885,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -14821,7 +13912,11 @@ private constructor( cadence().validate() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -14856,7 +13951,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -15574,135 +14669,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -16558,7 +15524,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -16585,7 +15551,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -16666,11 +15632,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -16811,16 +15781,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -16973,7 +15933,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -16986,7 +15945,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -17054,18 +16013,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -17408,7 +16368,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -17419,7 +16378,7 @@ private constructor( NewSubscriptionTieredPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -17446,7 +16405,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -17481,7 +16444,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -17655,135 +16618,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -19102,7 +17936,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -19129,7 +17963,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -19210,11 +18044,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -19356,16 +18194,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -19518,7 +18346,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -19531,7 +18358,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -19600,18 +18427,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -19954,7 +18782,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -19965,7 +18792,7 @@ private constructor( NewSubscriptionTieredBpsPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -19992,7 +18819,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -20027,7 +18858,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -20201,135 +19032,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -21691,7 +20393,7 @@ private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -21720,7 +20422,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -21805,11 +20507,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -21953,16 +20659,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -22106,7 +20802,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -22119,7 +20814,7 @@ private constructor( private var bpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -22198,18 +20893,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -22539,7 +21235,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -22550,7 +21245,7 @@ private constructor( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -22577,7 +21272,11 @@ private constructor( bpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -22612,7 +21311,7 @@ private constructor( (bpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -23003,135 +21702,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -23988,7 +22558,7 @@ private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -24017,7 +22587,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -24102,11 +22672,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -24250,16 +22824,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -24403,7 +22967,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -24416,7 +22979,7 @@ private constructor( private var bulkBpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -24497,18 +23060,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -24838,7 +23402,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -24849,7 +23412,7 @@ private constructor( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -24876,7 +23439,11 @@ private constructor( bulkBpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -24911,7 +23478,7 @@ private constructor( (bulkBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -25543,135 +24110,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -26528,7 +24966,7 @@ private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -26557,7 +24995,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -26642,11 +25080,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -26790,16 +25232,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -26943,7 +25375,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -26956,7 +25387,7 @@ private constructor( private var bulkConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -27035,18 +25466,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -27376,7 +25808,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -27387,7 +25818,7 @@ private constructor( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -27414,7 +25845,11 @@ private constructor( bulkConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -27449,7 +25884,7 @@ private constructor( (bulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -28039,135 +26474,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -29023,7 +27329,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -29050,7 +27356,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -29132,11 +27438,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -29278,16 +27588,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -29441,7 +27741,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -29454,7 +27753,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -29529,18 +27828,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -29885,7 +28185,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -29896,7 +28195,7 @@ private constructor( NewSubscriptionThresholdTotalAmountPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -29923,7 +28222,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -29958,7 +28261,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("threshold_total_amount")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -30132,135 +28437,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ThresholdTotalAmountConfig @JsonCreator private constructor( @@ -31230,7 +29406,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -31257,7 +29433,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -31338,11 +29514,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -31484,16 +29664,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -31646,7 +29816,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -31659,7 +29828,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -31728,18 +29897,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -32083,7 +30253,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -32094,7 +30263,7 @@ private constructor( NewSubscriptionTieredPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -32121,7 +30290,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -32156,7 +30329,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -32330,102 +30503,78 @@ private constructor( override fun toString() = value.toString() } - class ModelType + class TieredPackageConfig @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ + private constructor( @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { + private val additionalProperties: Map + ) { - @JvmField val TIERED_PACKAGE = of("tiered_package") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun toBuilder() = Builder().from(this) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } + companion object { - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. + * Returns a mutable builder for constructing an instance of + * [TieredPackageConfig]. */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN + /** A builder for [TieredPackageConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { + additionalProperties = + tieredPackageConfig.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") + 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) } + /** + * Returns an immutable instance of [TieredPackageConfig]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): TieredPackageConfig = + TieredPackageConfig(additionalProperties.toImmutable()) + } + private var validated: Boolean = false - fun validate(): ModelType = apply { + fun validate(): TieredPackageConfig = apply { if (validated) { return@apply } - known() validated = true } @@ -32444,31 +30593,97 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + return /* spotless:off */ other is TieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "TieredPackageConfig{additionalProperties=$additionalProperties}" } - class TieredPackageConfig - @JsonCreator + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + class BillingCycleConfiguration private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + durationUnit: JsonField = JsonMissing.of(), + ) : this(duration, durationUnit, mutableMapOf()) + + /** + * The duration of the billing period. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun duration(): Long = duration.getRequired("duration") + + /** + * The unit of billing period duration. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** + * Returns the raw JSON value of [duration]. + * + * Unlike [duration], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** + * Returns the raw JSON value of [durationUnit]. + * + * Unlike [durationUnit], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -32476,230 +30691,59 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [TieredPackageConfig]. + * [BillingCycleConfiguration]. + * + * The following fields are required: + * ```java + * .duration() + * .durationUnit() + * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [TieredPackageConfig]. */ + /** A builder for [BillingCycleConfiguration]. */ class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { - additionalProperties = - tieredPackageConfig.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) - } - - /** - * Returns an immutable instance of [TieredPackageConfig]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): TieredPackageConfig = - TieredPackageConfig(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): TieredPackageConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> - !value.isNull() && !value.isMissing() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredPackageConfig && 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() = - "TieredPackageConfig{additionalProperties=$additionalProperties}" - } - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - class BillingCycleConfiguration - private constructor( - private val duration: JsonField, - private val durationUnit: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - durationUnit: JsonField = JsonMissing.of(), - ) : this(duration, durationUnit, mutableMapOf()) - - /** - * The duration of the billing period. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun duration(): Long = duration.getRequired("duration") - - /** - * The unit of billing period duration. - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** - * Returns the raw JSON value of [duration]. - * - * Unlike [duration], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("duration") - @ExcludeMissing - fun _duration(): JsonField = duration - - /** - * Returns the raw JSON value of [durationUnit]. - * - * Unlike [durationUnit], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BillingCycleConfiguration]. - * - * The following fields are required: - * ```java - * .duration() - * .durationUnit() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** - * Sets [Builder.duration] to an arbitrary JSON value. - * - * You should usually call [Builder.duration] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** - * Sets [Builder.durationUnit] to an arbitrary JSON value. - * - * You should usually call [Builder.durationUnit] with a well-typed - * [DurationUnit] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** + * Sets [Builder.duration] to an arbitrary JSON value. + * + * You should usually call [Builder.duration] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** + * Sets [Builder.durationUnit] to an arbitrary JSON value. + * + * You should usually call [Builder.durationUnit] with a well-typed + * [DurationUnit] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } fun additionalProperties(additionalProperties: Map) = @@ -33427,7 +31471,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -33454,7 +31498,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -33535,11 +31579,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -33681,16 +31729,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -33844,7 +31882,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -33857,7 +31894,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -33930,18 +31967,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -34284,7 +32322,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -34295,7 +32332,7 @@ private constructor( NewSubscriptionTieredWithMinimumPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -34322,7 +32359,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -34357,7 +32398,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -34531,135 +32574,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -35629,7 +33543,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -35656,7 +33570,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -35737,11 +33651,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -35883,16 +33801,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -36046,7 +33954,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -36059,7 +33966,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -36129,18 +34036,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -36483,7 +34391,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -36494,7 +34401,7 @@ private constructor( NewSubscriptionUnitWithPercentPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -36521,7 +34428,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -36556,7 +34467,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -36730,135 +34641,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -37827,7 +35609,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -37854,7 +35636,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -37936,11 +35718,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -38082,16 +35868,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -38245,7 +36021,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -38258,7 +36033,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = @@ -38335,18 +36110,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -38691,7 +36467,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -38702,7 +36477,7 @@ private constructor( NewSubscriptionPackageWithAllocationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "packageWithAllocationConfig", @@ -38732,7 +36507,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -38767,7 +36546,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -38941,135 +36722,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -40040,7 +37692,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -40067,7 +37719,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -40149,11 +37801,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -40295,16 +37951,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -40458,7 +38104,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -40471,7 +38116,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null @@ -40545,18 +38190,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -40900,7 +38546,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -40911,7 +38556,7 @@ private constructor( NewSubscriptionTierWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -40938,7 +38583,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -40973,7 +38622,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -41147,135 +38798,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -42245,7 +39767,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -42272,7 +39794,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -42353,11 +39875,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -42499,16 +40025,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -42662,7 +40178,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -42675,7 +40190,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -42748,18 +40263,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -43102,7 +40618,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -43113,7 +40628,7 @@ private constructor( NewSubscriptionUnitWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -43140,7 +40655,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -43175,7 +40694,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("unit_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -43349,135 +40870,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -44448,7 +41840,7 @@ private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -44477,7 +41869,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -44563,11 +41955,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -44712,16 +42108,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -44865,7 +42251,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -44878,7 +42263,7 @@ private constructor( private var cadence: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -44964,18 +42349,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -45305,7 +42691,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -45316,7 +42701,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -45343,7 +42728,11 @@ private constructor( cadence().validate() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -45378,7 +42767,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -45665,135 +43054,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -46651,7 +43911,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -46681,7 +43941,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -46769,11 +44029,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -46918,16 +44182,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -47071,7 +44325,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -47086,7 +44339,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -47187,18 +44441,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -47529,7 +44784,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -47543,7 +44797,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -47570,7 +44824,11 @@ private constructor( cadence().validate() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -47605,7 +44863,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -47893,136 +45153,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -48879,7 +46009,7 @@ private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -48908,7 +46038,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -48994,11 +46124,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -49143,16 +46277,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -49296,7 +46420,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -49309,7 +46432,7 @@ private constructor( private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -49395,18 +46518,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -49736,7 +46860,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -49747,7 +46870,7 @@ private constructor( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -49774,7 +46897,11 @@ private constructor( bulkWithProrationConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -49809,7 +46936,9 @@ private constructor( (bulkWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("bulk_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -50096,135 +47225,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -51080,7 +48080,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -51108,7 +48108,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -51191,11 +48191,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -51339,16 +48343,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -51503,7 +48497,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -51516,7 +48509,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -51599,18 +48593,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -51964,7 +48959,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -51975,7 +48969,7 @@ private constructor( NewSubscriptionScalableMatrixWithUnitPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -52005,7 +48999,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -52040,7 +49038,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -52215,139 +49215,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = - of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -53319,7 +50186,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -53347,7 +50214,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -53430,11 +50297,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -53578,16 +50449,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -53742,7 +50603,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -53755,7 +50615,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -53839,18 +50700,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -54204,7 +51066,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -54215,7 +51076,7 @@ private constructor( NewSubscriptionScalableMatrixWithTieredPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -54245,7 +51106,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -54280,7 +51145,10 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 + else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -54455,139 +51323,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -55563,7 +52298,7 @@ private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -55593,7 +52328,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -55679,11 +52414,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -55828,16 +52567,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -55981,7 +52710,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -55996,7 +52724,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -56086,18 +52814,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -56427,7 +53156,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -56441,7 +53169,7 @@ private constructor( cumulativeGroupedBulkConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -56468,7 +53196,11 @@ private constructor( cadence().validate() cumulativeGroupedBulkConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -56503,7 +53235,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -56791,135 +53525,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -57776,7 +54381,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -57806,7 +54411,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -57892,11 +54497,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -58041,16 +54650,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -58194,7 +54793,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -58209,7 +54807,7 @@ private constructor( private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -58299,18 +54897,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -58640,7 +55239,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -58654,7 +55252,7 @@ private constructor( "maxGroupTieredPackageConfig", maxGroupTieredPackageConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -58681,7 +55279,11 @@ private constructor( cadence().validate() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -58716,7 +55318,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -59004,135 +55608,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -59990,7 +56465,7 @@ private constructor( private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -60020,7 +56495,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -60108,11 +56583,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -60257,16 +56736,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -60410,7 +56879,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -60425,7 +56893,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -60525,18 +56994,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -60867,7 +57337,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -60881,7 +57350,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -60908,7 +57377,11 @@ private constructor( cadence().validate() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -60943,7 +57416,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -61231,136 +57706,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -62217,7 +58562,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -62247,7 +58592,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -62333,11 +58678,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -62482,16 +58831,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -62635,7 +58974,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -62650,7 +58988,7 @@ private constructor( private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -62740,18 +59078,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -63081,7 +59420,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -63095,7 +59433,7 @@ private constructor( "matrixWithDisplayNameConfig", matrixWithDisplayNameConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -63122,7 +59460,11 @@ private constructor( cadence().validate() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -63157,7 +59499,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -63445,135 +59789,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -64430,7 +60645,7 @@ private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -64460,7 +60675,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -64546,11 +60761,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -64695,16 +60914,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -64848,7 +61057,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -64862,7 +61070,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -64951,18 +61159,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -65292,7 +61501,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -65303,7 +61511,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -65330,7 +61538,11 @@ private constructor( cadence().validate() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -65365,7 +61577,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -65652,135 +61866,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -67907,7 +63992,7 @@ private constructor( class NewPercentageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val percentageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -67918,7 +64003,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -67937,11 +64022,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -67971,16 +64062,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -68031,7 +64112,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -68042,7 +64122,7 @@ private constructor( /** A builder for [NewPercentageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var percentageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -68059,17 +64139,19 @@ private constructor( newPercentageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -68161,7 +64243,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .percentageDiscount() * ``` @@ -68170,7 +64251,7 @@ private constructor( */ fun build(): NewPercentageDiscount = NewPercentageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -68187,7 +64268,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() percentageDiscount() isInvoiceLevel() @@ -68210,141 +64297,13 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -68365,7 +64324,7 @@ private constructor( class NewUsageDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val usageDiscount: JsonField, private val isInvoiceLevel: JsonField, @@ -68376,7 +64335,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -68395,11 +64354,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -68428,16 +64393,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -68487,7 +64442,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -68498,7 +64452,7 @@ private constructor( /** A builder for [NewUsageDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var usageDiscount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -68514,17 +64468,19 @@ private constructor( additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -68616,7 +64572,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .usageDiscount() * ``` @@ -68625,7 +64580,7 @@ private constructor( */ fun build(): NewUsageDiscount = NewUsageDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -68642,7 +64597,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() usageDiscount() isInvoiceLevel() @@ -68665,141 +64626,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("usage_discount")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -68820,7 +64651,7 @@ private constructor( class NewAmountDiscount private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -68831,7 +64662,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -68850,11 +64681,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -68883,16 +64720,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -68943,7 +64770,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -68954,7 +64780,7 @@ private constructor( /** A builder for [NewAmountDiscount]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -68970,17 +64796,19 @@ private constructor( additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -69072,7 +64900,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * ``` @@ -69081,7 +64908,7 @@ private constructor( */ fun build(): NewAmountDiscount = NewAmountDiscount( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -69098,7 +64925,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -69121,141 +64954,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("amount_discount")) 1 else 0 } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -69276,7 +64979,7 @@ private constructor( class NewMinimum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val itemId: JsonField, private val minimumAmount: JsonField, @@ -69288,7 +64991,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -69311,11 +65014,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -69353,16 +65062,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -69420,7 +65119,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -69432,7 +65130,7 @@ private constructor( /** A builder for [NewMinimum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var itemId: JsonField? = null private var minimumAmount: JsonField? = null @@ -69449,17 +65147,19 @@ private constructor( additionalProperties = newMinimum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -69563,7 +65263,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .itemId() * .minimumAmount() @@ -69573,7 +65272,7 @@ private constructor( */ fun build(): NewMinimum = NewMinimum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -69591,7 +65290,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() itemId() minimumAmount() @@ -69615,142 +65320,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -69771,7 +65346,7 @@ private constructor( class NewMaximum private constructor( - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val maximumAmount: JsonField, private val isInvoiceLevel: JsonField, @@ -69782,7 +65357,7 @@ private constructor( private constructor( @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -69801,11 +65376,17 @@ private constructor( ) /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The set of price IDs to which this adjustment applies. @@ -69834,16 +65415,6 @@ private constructor( fun isInvoiceLevel(): Optional = isInvoiceLevel.getOptional("is_invoice_level") - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -69893,7 +65464,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -69904,7 +65474,7 @@ private constructor( /** A builder for [NewMaximum]. */ class Builder internal constructor() { - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var maximumAmount: JsonField? = null private var isInvoiceLevel: JsonField = JsonMissing.of() @@ -69919,17 +65489,19 @@ private constructor( additionalProperties = newMaximum.additionalProperties.toMutableMap() } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -70021,7 +65593,6 @@ private constructor( * * The following fields are required: * ```java - * .adjustmentType() * .appliesToPriceIds() * .maximumAmount() * ``` @@ -70030,7 +65601,7 @@ private constructor( */ fun build(): NewMaximum = NewMaximum( - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -70047,7 +65618,13 @@ private constructor( return@apply } - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() maximumAmount() isInvoiceLevel() @@ -70070,141 +65647,11 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -73321,7 +68768,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitConfig: JsonField, private val billableMetricId: JsonField, @@ -73348,7 +68795,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -73429,11 +68876,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -73574,16 +69025,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -73736,7 +69177,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -73749,7 +69189,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit") private var name: JsonField? = null private var unitConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -73816,18 +69256,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -74169,7 +69610,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitConfig() * ``` @@ -74180,7 +69620,7 @@ private constructor( NewSubscriptionUnitPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitConfig", unitConfig), billableMetricId, @@ -74207,7 +69647,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitConfig().validate() billableMetricId() @@ -74242,7 +69686,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -74416,135 +69860,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT = of("unit") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT -> Value.UNIT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT -> Known.UNIT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitConfig private constructor( private val unitAmount: JsonField, @@ -75571,7 +70886,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageConfig: JsonField, private val billableMetricId: JsonField, @@ -75598,7 +70913,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -75679,11 +70994,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -75824,16 +71143,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -75986,7 +71295,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -75999,7 +71307,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package") private var name: JsonField? = null private var packageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -76067,18 +71375,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -76421,7 +71730,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageConfig() * ``` @@ -76432,7 +71740,7 @@ private constructor( NewSubscriptionPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("packageConfig", packageConfig), billableMetricId, @@ -76459,7 +71767,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageConfig().validate() billableMetricId() @@ -76494,7 +71806,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -76668,135 +71980,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE = of("package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageConfig private constructor( private val packageAmount: JsonField, @@ -77875,7 +73058,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -77904,7 +73087,7 @@ private constructor( matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -77989,11 +73172,15 @@ private constructor( fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -78137,16 +73324,6 @@ private constructor( @ExcludeMissing fun _matrixConfig(): JsonField = matrixConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -78290,7 +73467,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` */ @@ -78303,7 +73479,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -78384,18 +73560,19 @@ private constructor( this.matrixConfig = matrixConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -78725,7 +73902,6 @@ private constructor( * .cadence() * .itemId() * .matrixConfig() - * .modelType() * .name() * ``` * @@ -78736,7 +73912,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -78763,7 +73939,11 @@ private constructor( cadence().validate() itemId() matrixConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -78798,7 +73978,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("matrix")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -79516,135 +74696,6 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX = of("matrix") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -80500,7 +75551,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredConfig: JsonField, private val billableMetricId: JsonField, @@ -80527,7 +75578,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -80608,11 +75659,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -80753,16 +75808,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -80915,7 +75960,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -80928,7 +75972,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered") private var name: JsonField? = null private var tieredConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -80996,18 +76040,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -81350,7 +76395,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredConfig() * ``` @@ -81361,7 +76405,7 @@ private constructor( NewSubscriptionTieredPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredConfig", tieredConfig), billableMetricId, @@ -81388,7 +76432,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredConfig().validate() billableMetricId() @@ -81423,7 +76471,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -81597,135 +76645,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED = of("tiered") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED -> Value.TIERED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredConfig private constructor( private val tiers: JsonField>, @@ -83044,7 +77963,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredBpsConfig: JsonField, private val billableMetricId: JsonField, @@ -83071,7 +77990,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -83152,11 +78071,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -83298,16 +78221,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -83460,7 +78373,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -83473,7 +78385,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_bps") private var name: JsonField? = null private var tieredBpsConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -83542,18 +78454,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -83896,7 +78809,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredBpsConfig() * ``` @@ -83907,7 +78819,7 @@ private constructor( NewSubscriptionTieredBpsPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredBpsConfig", tieredBpsConfig), billableMetricId, @@ -83934,7 +78846,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredBpsConfig().validate() billableMetricId() @@ -83969,7 +78885,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -84143,135 +79059,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_BPS = of("tiered_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_BPS -> Value.TIERED_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredBpsConfig private constructor( private val tiers: JsonField>, @@ -85633,7 +80420,7 @@ private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -85662,7 +80449,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -85747,11 +80534,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -85895,16 +80686,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -86048,7 +80829,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -86061,7 +80841,7 @@ private constructor( private var bpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -86140,18 +80920,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -86481,7 +81262,6 @@ private constructor( * .bpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -86492,7 +81272,7 @@ private constructor( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -86519,7 +81299,11 @@ private constructor( bpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -86554,7 +81338,7 @@ private constructor( (bpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -86945,135 +81729,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BPS = of("bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BPS -> Value.BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BPS -> Known.BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -87930,7 +82585,7 @@ private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -87959,7 +82614,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -88044,11 +82699,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -88192,16 +82851,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -88345,7 +82994,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -88358,7 +83006,7 @@ private constructor( private var bulkBpsConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_bps") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -88439,18 +83087,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_bps") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -88780,7 +83429,6 @@ private constructor( * .bulkBpsConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -88791,7 +83439,7 @@ private constructor( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -88818,7 +83466,11 @@ private constructor( bulkBpsConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_bps")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -88853,7 +83505,7 @@ private constructor( (bulkBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk_bps")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -89485,135 +84137,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_BPS = of("bulk_bps") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_BPS, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_BPS -> Value.BULK_BPS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_BPS -> Known.BULK_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -90470,7 +84993,7 @@ private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -90499,7 +85022,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -90584,11 +85107,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -90732,16 +85259,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -90885,7 +85402,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -90898,7 +85414,7 @@ private constructor( private var bulkConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -90977,18 +85493,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -91318,7 +85835,6 @@ private constructor( * .bulkConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -91329,7 +85845,7 @@ private constructor( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -91356,7 +85872,11 @@ private constructor( bulkConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -91391,7 +85911,7 @@ private constructor( (bulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("bulk")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -91981,135 +86501,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK = of("bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK -> Value.BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK -> Known.BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -92965,7 +87356,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val thresholdTotalAmountConfig: JsonField, private val billableMetricId: JsonField, @@ -92992,7 +87383,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -93074,11 +87465,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -93220,16 +87615,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -93383,7 +87768,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -93396,7 +87780,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("threshold_total_amount") private var name: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null @@ -93471,18 +87855,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("threshold_total_amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -93827,7 +88212,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .thresholdTotalAmountConfig() * ``` @@ -93838,7 +88222,7 @@ private constructor( NewSubscriptionThresholdTotalAmountPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), billableMetricId, @@ -93865,7 +88249,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("threshold_total_amount")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() thresholdTotalAmountConfig().validate() billableMetricId() @@ -93900,7 +88288,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("threshold_total_amount")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -94074,135 +88464,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - THRESHOLD_TOTAL_AMOUNT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ThresholdTotalAmountConfig @JsonCreator private constructor( @@ -95172,7 +89433,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredPackageConfig: JsonField, private val billableMetricId: JsonField, @@ -95199,7 +89460,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -95280,11 +89541,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -95426,16 +89691,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -95588,7 +89843,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -95601,7 +89855,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_package") private var name: JsonField? = null private var tieredPackageConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -95670,18 +89924,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -96025,7 +90280,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredPackageConfig() * ``` @@ -96036,7 +90290,7 @@ private constructor( NewSubscriptionTieredPackagePrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredPackageConfig", tieredPackageConfig), billableMetricId, @@ -96063,7 +90317,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredPackageConfig().validate() billableMetricId() @@ -96098,7 +90356,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("tiered_package")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -96272,135 +90530,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_PACKAGE = of("tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredPackageConfig @JsonCreator private constructor( @@ -97369,7 +91498,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithMinimumConfig: JsonField, private val billableMetricId: JsonField, @@ -97396,7 +91525,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -97477,11 +91606,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -97623,16 +91756,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -97786,7 +91909,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -97799,7 +91921,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_minimum") private var name: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -97872,18 +91994,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -98226,7 +92349,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithMinimumConfig() * ``` @@ -98237,7 +92359,7 @@ private constructor( NewSubscriptionTieredWithMinimumPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), billableMetricId, @@ -98264,7 +92386,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithMinimumConfig().validate() billableMetricId() @@ -98299,7 +92425,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -98473,135 +92601,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithMinimumConfig @JsonCreator private constructor( @@ -99571,7 +93570,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithPercentConfig: JsonField, private val billableMetricId: JsonField, @@ -99598,7 +93597,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -99679,11 +93678,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -99825,16 +93828,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -99988,7 +93981,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -100001,7 +93993,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_percent") private var name: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -100071,18 +94063,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_percent") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -100425,7 +94418,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithPercentConfig() * ``` @@ -100436,7 +94428,7 @@ private constructor( NewSubscriptionUnitWithPercentPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithPercentConfig", unitWithPercentConfig), billableMetricId, @@ -100463,7 +94455,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_percent")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithPercentConfig().validate() billableMetricId() @@ -100498,7 +94494,7 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("unit_with_percent")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -100672,135 +94668,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PERCENT - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PERCENT, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithPercentConfig @JsonCreator private constructor( @@ -101769,7 +95636,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val packageWithAllocationConfig: JsonField, private val billableMetricId: JsonField, @@ -101796,7 +95663,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -101878,11 +95745,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -102024,16 +95895,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -102187,7 +96048,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -102200,7 +96060,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("package_with_allocation") private var name: JsonField? = null private var packageWithAllocationConfig: JsonField? = @@ -102277,18 +96137,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("package_with_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -102633,7 +96494,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .packageWithAllocationConfig() * ``` @@ -102644,7 +96504,7 @@ private constructor( NewSubscriptionPackageWithAllocationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "packageWithAllocationConfig", @@ -102674,7 +96534,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("package_with_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() packageWithAllocationConfig().validate() billableMetricId() @@ -102709,7 +96573,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("package_with_allocation")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -102883,135 +96749,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PACKAGE_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class PackageWithAllocationConfig @JsonCreator private constructor( @@ -103982,7 +97719,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val tieredWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -104009,7 +97746,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -104091,11 +97828,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -104237,16 +97978,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -104400,7 +98131,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -104413,7 +98143,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("tiered_with_proration") private var name: JsonField? = null private var tieredWithProrationConfig: JsonField? = null @@ -104487,18 +98217,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("tiered_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -104842,7 +98573,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .tieredWithProrationConfig() * ``` @@ -104853,7 +98583,7 @@ private constructor( NewSubscriptionTierWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), billableMetricId, @@ -104880,7 +98610,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("tiered_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() tieredWithProrationConfig().validate() billableMetricId() @@ -104915,7 +98649,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("tiered_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -105089,135 +98825,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TieredWithProrationConfig @JsonCreator private constructor( @@ -106187,7 +99794,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val unitWithProrationConfig: JsonField, private val billableMetricId: JsonField, @@ -106214,7 +99821,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -106295,11 +99902,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -106441,16 +100052,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -106604,7 +100205,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -106617,7 +100217,7 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("unit_with_proration") private var name: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() @@ -106690,18 +100290,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("unit_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -107044,7 +100645,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .unitWithProrationConfig() * ``` @@ -107055,7 +100655,7 @@ private constructor( NewSubscriptionUnitWithProrationPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired("unitWithProrationConfig", unitWithProrationConfig), billableMetricId, @@ -107082,7 +100682,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("unit_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() unitWithProrationConfig().validate() billableMetricId() @@ -107117,7 +100721,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("unit_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + @@ -107291,135 +100897,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - UNIT_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - UNIT_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class UnitWithProrationConfig @JsonCreator private constructor( @@ -108390,7 +101867,7 @@ private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -108419,7 +101896,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -108505,11 +101982,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -108654,16 +102135,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -108807,7 +102278,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -108820,7 +102290,7 @@ private constructor( private var cadence: JsonField? = null private var groupedAllocationConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_allocation") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -108906,18 +102376,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_allocation") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -109247,7 +102718,6 @@ private constructor( * .cadence() * .groupedAllocationConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -109258,7 +102728,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -109285,7 +102755,11 @@ private constructor( cadence().validate() groupedAllocationConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_allocation")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -109320,7 +102794,7 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { if (it == JsonValue.from("grouped_allocation")) 1 else 0 } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -109607,135 +103081,6 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -110593,7 +103938,7 @@ private constructor( private val groupedWithProratedMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -110623,7 +103968,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -110711,11 +104056,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -110860,16 +104209,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -111013,7 +104352,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -111028,7 +104366,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_prorated_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -111129,18 +104468,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_prorated_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -111471,7 +104811,6 @@ private constructor( * .cadence() * .groupedWithProratedMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -111485,7 +104824,7 @@ private constructor( groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -111512,7 +104851,11 @@ private constructor( cadence().validate() groupedWithProratedMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_prorated_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -111547,7 +104890,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithProratedMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_prorated_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -111835,136 +105180,6 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -112821,7 +106036,7 @@ private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -112850,7 +106065,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -112936,11 +106151,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -113085,16 +106304,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -113238,7 +106447,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` */ @@ -113251,7 +106459,7 @@ private constructor( private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("bulk_with_proration") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -113337,18 +106545,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("bulk_with_proration") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -113678,7 +106887,6 @@ private constructor( * .bulkWithProrationConfig() * .cadence() * .itemId() - * .modelType() * .name() * ``` * @@ -113689,7 +106897,7 @@ private constructor( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -113716,7 +106924,11 @@ private constructor( bulkWithProrationConfig().validate() cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("bulk_with_proration")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -113751,7 +106963,9 @@ private constructor( (bulkWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("bulk_with_proration")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -114038,135 +107252,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BULK_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -115022,7 +108107,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, @@ -115050,7 +108135,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -115133,11 +108218,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -115281,16 +108370,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -115445,7 +108524,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -115458,7 +108536,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_unit_pricing") private var name: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = @@ -115541,18 +108620,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_unit_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -115906,7 +108986,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithUnitPricingConfig() * ``` @@ -115917,7 +108996,7 @@ private constructor( NewSubscriptionScalableMatrixWithUnitPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", @@ -115947,7 +109026,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_unit_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithUnitPricingConfig().validate() billableMetricId() @@ -115982,7 +109065,9 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_unit_pricing")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -116157,139 +109242,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = - of("scalable_matrix_with_unit_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_UNIT_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Value.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_UNIT_PRICING -> - Known.SCALABLE_MATRIX_WITH_UNIT_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithUnitPricingConfig @JsonCreator private constructor( @@ -117261,7 +110213,7 @@ private constructor( private constructor( private val cadence: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, @@ -117289,7 +110241,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -117372,11 +110324,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -117520,16 +110476,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -117684,7 +110630,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -117697,7 +110642,8 @@ private constructor( private var cadence: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("scalable_matrix_with_tiered_pricing") private var name: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = @@ -117781,18 +110727,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("scalable_matrix_with_tiered_pricing") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -118146,7 +111093,6 @@ private constructor( * ```java * .cadence() * .itemId() - * .modelType() * .name() * .scalableMatrixWithTieredPricingConfig() * ``` @@ -118157,7 +111103,7 @@ private constructor( NewSubscriptionScalableMatrixWithTieredPricingPrice( checkRequired("cadence", cadence), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", @@ -118187,7 +111133,11 @@ private constructor( cadence().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("scalable_matrix_with_tiered_pricing")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() scalableMatrixWithTieredPricingConfig().validate() billableMetricId() @@ -118222,7 +111172,10 @@ private constructor( internal fun validity(): Int = (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("scalable_matrix_with_tiered_pricing")) 1 + else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + @@ -118397,139 +111350,6 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = - of("scalable_matrix_with_tiered_pricing") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Value.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - SCALABLE_MATRIX_WITH_TIERED_PRICING -> - Known.SCALABLE_MATRIX_WITH_TIERED_PRICING - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class ScalableMatrixWithTieredPricingConfig @JsonCreator private constructor( @@ -119505,7 +112325,7 @@ private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -119535,7 +112355,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -119621,11 +112441,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -119770,16 +112594,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -119923,7 +112737,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -119938,7 +112751,7 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("cumulative_grouped_bulk") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -120028,18 +112841,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("cumulative_grouped_bulk") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -120369,7 +113183,6 @@ private constructor( * .cadence() * .cumulativeGroupedBulkConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -120383,7 +113196,7 @@ private constructor( cumulativeGroupedBulkConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -120410,7 +113223,11 @@ private constructor( cadence().validate() cumulativeGroupedBulkConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("cumulative_grouped_bulk")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -120445,7 +113262,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (cumulativeGroupedBulkConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("cumulative_grouped_bulk")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -120733,135 +113552,6 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CUMULATIVE_GROUPED_BULK, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CUMULATIVE_GROUPED_BULK -> Value.CUMULATIVE_GROUPED_BULK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CUMULATIVE_GROUPED_BULK -> Known.CUMULATIVE_GROUPED_BULK - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -121718,7 +114408,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val maxGroupTieredPackageConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -121748,7 +114438,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -121834,11 +114524,15 @@ private constructor( maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -121983,16 +114677,6 @@ private constructor( fun _maxGroupTieredPackageConfig(): JsonField = maxGroupTieredPackageConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -122136,7 +114820,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` */ @@ -122151,7 +114834,7 @@ private constructor( private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("max_group_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -122241,18 +114924,19 @@ private constructor( maxGroupTieredPackageConfig: JsonField ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("max_group_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -122582,7 +115266,6 @@ private constructor( * .cadence() * .itemId() * .maxGroupTieredPackageConfig() - * .modelType() * .name() * ``` * @@ -122596,7 +115279,7 @@ private constructor( "maxGroupTieredPackageConfig", maxGroupTieredPackageConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -122623,7 +115306,11 @@ private constructor( cadence().validate() itemId() maxGroupTieredPackageConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("max_group_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -122658,7 +115345,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (maxGroupTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("max_group_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -122946,135 +115635,6 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAX_GROUP_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -123932,7 +116492,7 @@ private constructor( private val groupedWithMeteredMinimumConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -123962,7 +116522,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -124050,11 +116610,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -124199,16 +116763,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -124352,7 +116906,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -124367,7 +116920,8 @@ private constructor( JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = + JsonValue.from("grouped_with_metered_minimum") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -124467,18 +117021,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_with_metered_minimum") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -124809,7 +117364,6 @@ private constructor( * .cadence() * .groupedWithMeteredMinimumConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -124823,7 +117377,7 @@ private constructor( groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -124850,7 +117404,11 @@ private constructor( cadence().validate() groupedWithMeteredMinimumConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_with_metered_minimum")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -124885,7 +117443,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedWithMeteredMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_with_metered_minimum")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -125173,136 +117733,6 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField - val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_WITH_METERED_MINIMUM, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -126159,7 +118589,7 @@ private constructor( private val cadence: JsonField, private val itemId: JsonField, private val matrixWithDisplayNameConfig: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -126189,7 +118619,7 @@ private constructor( JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -126275,11 +118705,15 @@ private constructor( matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -126424,16 +118858,6 @@ private constructor( fun _matrixWithDisplayNameConfig(): JsonField = matrixWithDisplayNameConfig - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -126577,7 +119001,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` */ @@ -126592,7 +119015,7 @@ private constructor( private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("matrix_with_display_name") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -126682,18 +119105,19 @@ private constructor( matrixWithDisplayNameConfig: JsonField ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("matrix_with_display_name") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -127023,7 +119447,6 @@ private constructor( * .cadence() * .itemId() * .matrixWithDisplayNameConfig() - * .modelType() * .name() * ``` * @@ -127037,7 +119460,7 @@ private constructor( "matrixWithDisplayNameConfig", matrixWithDisplayNameConfig, ), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -127064,7 +119487,11 @@ private constructor( cadence().validate() itemId() matrixWithDisplayNameConfig().validate() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("matrix_with_display_name")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -127099,7 +119526,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (matrixWithDisplayNameConfig.asKnown().getOrNull()?.validity() ?: 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("matrix_with_display_name")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -127387,135 +119816,6 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MATRIX_WITH_DISPLAY_NAME, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. @@ -128372,7 +120672,7 @@ private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, private val itemId: JsonField, - private val modelType: JsonField, + private val modelType: JsonValue, private val name: JsonField, private val billableMetricId: JsonField, private val billedInAdvance: JsonField, @@ -128402,7 +120702,7 @@ private constructor( itemId: JsonField = JsonMissing.of(), @JsonProperty("model_type") @ExcludeMissing - modelType: JsonField = JsonMissing.of(), + modelType: JsonValue = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @@ -128488,11 +120788,15 @@ private constructor( fun itemId(): String = itemId.getRequired("item_id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun modelType(): ModelType = modelType.getRequired("model_type") + @JsonProperty("model_type") @ExcludeMissing fun _modelType(): JsonValue = modelType /** * The name of the price. @@ -128637,16 +120941,6 @@ private constructor( */ @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** - * Returns the raw JSON value of [modelType]. - * - * Unlike [modelType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - /** * Returns the raw JSON value of [name]. * @@ -128790,7 +121084,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` */ @@ -128804,7 +121097,7 @@ private constructor( private var groupedTieredPackageConfig: JsonField? = null private var itemId: JsonField? = null - private var modelType: JsonField? = null + private var modelType: JsonValue = JsonValue.from("grouped_tiered_package") private var name: JsonField? = null private var billableMetricId: JsonField = JsonMissing.of() private var billedInAdvance: JsonField = JsonMissing.of() @@ -128893,18 +121186,19 @@ private constructor( */ fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Sets [Builder.modelType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.modelType] with a well-typed [ModelType] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("grouped_tiered_package") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun modelType(modelType: JsonField) = apply { - this.modelType = modelType - } + fun modelType(modelType: JsonValue) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = name(JsonField.of(name)) @@ -129234,7 +121528,6 @@ private constructor( * .cadence() * .groupedTieredPackageConfig() * .itemId() - * .modelType() * .name() * ``` * @@ -129245,7 +121538,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), - checkRequired("modelType", modelType), + modelType, checkRequired("name", name), billableMetricId, billedInAdvance, @@ -129272,7 +121565,11 @@ private constructor( cadence().validate() groupedTieredPackageConfig().validate() itemId() - modelType().validate() + _modelType().let { + if (it != JsonValue.from("grouped_tiered_package")) { + throw OrbInvalidDataException("'modelType' is invalid, received $it") + } + } name() billableMetricId() billedInAdvance() @@ -129307,7 +121604,9 @@ private constructor( (cadence.asKnown().getOrNull()?.validity() ?: 0) + (groupedTieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (itemId.asKnown().isPresent) 1 else 0) + - (modelType.asKnown().getOrNull()?.validity() ?: 0) + + modelType.let { + if (it == JsonValue.from("grouped_tiered_package")) 1 else 0 + } + (if (name.asKnown().isPresent) 1 else 0) + (if (billableMetricId.asKnown().isPresent) 1 else 0) + (if (billedInAdvance.asKnown().isPresent) 1 else 0) + @@ -129594,135 +121893,6 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE - } - - /** - * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ModelType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - GROUPED_TIERED_PACKAGE, - /** - * An enum member indicating that [ModelType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ModelType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * For custom cadence: specifies the duration of the billing period in days or * months. 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 f105c093f..1e50552d4 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 @@ -2221,7 +2221,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2235,7 +2235,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2270,11 +2270,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2330,16 +2336,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2409,7 +2405,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2424,7 +2419,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2461,17 +2456,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2613,7 +2610,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2626,7 +2622,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2646,7 +2642,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2672,143 +2674,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2830,7 +2704,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2844,7 +2718,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2879,11 +2753,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2939,16 +2819,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3018,7 +2888,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3033,7 +2902,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3070,17 +2939,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3222,7 +3093,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3235,7 +3105,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3255,7 +3125,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3281,143 +3157,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3439,7 +3187,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3453,7 +3201,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3488,11 +3236,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3549,16 +3303,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3628,7 +3372,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3643,7 +3386,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3682,17 +3425,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3834,7 +3579,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3847,7 +3591,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3867,7 +3611,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3893,143 +3643,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4051,7 +3673,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4066,7 +3688,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4105,11 +3727,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4174,16 +3802,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4261,7 +3879,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4277,7 +3894,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4315,17 +3932,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4479,7 +4098,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4493,7 +4111,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4514,7 +4132,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4541,7 +4165,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4549,147 +4173,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4700,7 +4194,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4714,7 +4208,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4749,11 +4243,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4809,16 +4309,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4888,7 +4378,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4903,7 +4392,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4939,17 +4428,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5091,7 +4582,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5104,7 +4594,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5124,7 +4614,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5150,143 +4646,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5792,7 +5158,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5811,7 +5177,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5858,11 +5224,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5911,16 +5283,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5963,7 +5325,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5977,7 +5338,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6068,17 +5429,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6143,7 +5506,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6159,7 +5521,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6176,7 +5538,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6201,137 +5567,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6354,7 +5593,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6371,7 +5610,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6412,11 +5651,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6464,16 +5709,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6525,7 +5760,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6539,7 +5773,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6618,17 +5852,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6709,7 +5945,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6725,7 +5960,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6742,7 +5977,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6767,138 +6006,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6921,7 +6033,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6938,7 +6050,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6979,11 +6091,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7032,16 +6150,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7093,7 +6201,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7107,7 +6214,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7183,17 +6290,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7275,7 +6384,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7291,7 +6399,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7308,7 +6416,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7333,138 +6445,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 b2206c150..d37bc012b 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 @@ -2218,7 +2218,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2232,7 +2232,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2267,11 +2267,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2327,16 +2333,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2406,7 +2402,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2421,7 +2416,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2458,17 +2453,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2610,7 +2607,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2623,7 +2619,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2643,7 +2639,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2669,143 +2671,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2827,7 +2701,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2841,7 +2715,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2876,11 +2750,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2936,16 +2816,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3015,7 +2885,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3030,7 +2899,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3067,17 +2936,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3219,7 +3090,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3232,7 +3102,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3252,7 +3122,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3278,143 +3154,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3436,7 +3184,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3450,7 +3198,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3485,11 +3233,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3546,16 +3300,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3625,7 +3369,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3640,7 +3383,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3679,17 +3422,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3831,7 +3576,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3844,7 +3588,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3864,7 +3608,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3890,143 +3640,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4048,7 +3670,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4063,7 +3685,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4102,11 +3724,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4171,16 +3799,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4258,7 +3876,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4274,7 +3891,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4312,17 +3929,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4476,7 +4095,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4490,7 +4108,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4511,7 +4129,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4538,7 +4162,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4546,147 +4170,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4697,7 +4191,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4711,7 +4205,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4746,11 +4240,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4806,16 +4306,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4885,7 +4375,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4900,7 +4389,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4936,17 +4425,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5088,7 +4579,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5101,7 +4591,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5121,7 +4611,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5147,143 +4643,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5789,7 +5155,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5808,7 +5174,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5855,11 +5221,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5908,16 +5280,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5960,7 +5322,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5974,7 +5335,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6065,17 +5426,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6140,7 +5503,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6156,7 +5518,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6173,7 +5535,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6198,137 +5564,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6351,7 +5590,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6368,7 +5607,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6409,11 +5648,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6461,16 +5706,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6522,7 +5757,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6536,7 +5770,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6615,17 +5849,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6706,7 +5942,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6722,7 +5957,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6739,7 +5974,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6764,138 +6003,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6918,7 +6030,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6935,7 +6047,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6976,11 +6088,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7029,16 +6147,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7090,7 +6198,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7104,7 +6211,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7180,17 +6287,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7272,7 +6381,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7288,7 +6396,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7305,7 +6413,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7330,138 +6442,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 3594ee80c..17ac0823a 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 @@ -2227,7 +2227,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2241,7 +2241,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2276,11 +2276,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2336,16 +2342,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2415,7 +2411,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2430,7 +2425,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2467,17 +2462,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2619,7 +2616,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2632,7 +2628,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2652,7 +2648,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2678,143 +2680,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2836,7 +2710,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2850,7 +2724,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2885,11 +2759,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2945,16 +2825,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3024,7 +2894,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3039,7 +2908,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3076,17 +2945,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3228,7 +3099,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3241,7 +3111,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3261,7 +3131,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3287,143 +3163,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3445,7 +3193,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3459,7 +3207,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3494,11 +3242,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3555,16 +3309,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3634,7 +3378,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3649,7 +3392,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3688,17 +3431,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3840,7 +3585,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3853,7 +3597,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3873,7 +3617,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3899,143 +3649,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4057,7 +3679,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4072,7 +3694,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4111,11 +3733,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4180,16 +3808,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4267,7 +3885,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4283,7 +3900,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4321,17 +3938,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4485,7 +4104,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4499,7 +4117,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4520,7 +4138,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4547,7 +4171,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4555,147 +4179,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4706,7 +4200,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4720,7 +4214,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4755,11 +4249,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4815,16 +4315,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4894,7 +4384,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4909,7 +4398,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4945,17 +4434,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5097,7 +4588,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5110,7 +4600,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5130,7 +4620,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5156,143 +4652,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5798,7 +5164,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5817,7 +5183,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5864,11 +5230,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5917,16 +5289,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5969,7 +5331,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5983,7 +5344,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6074,17 +5435,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6149,7 +5512,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6165,7 +5527,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6182,7 +5544,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6207,137 +5573,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6360,7 +5599,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6377,7 +5616,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6418,11 +5657,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6470,16 +5715,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6531,7 +5766,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6545,7 +5779,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6624,17 +5858,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6715,7 +5951,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6731,7 +5966,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6748,7 +5983,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6773,138 +6012,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6927,7 +6039,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6944,7 +6056,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6985,11 +6097,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7038,16 +6156,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7099,7 +6207,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7113,7 +6220,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7189,17 +6296,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7281,7 +6390,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7297,7 +6405,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7314,7 +6422,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7339,138 +6451,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 d9f8a26e2..58a27d0e3 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 @@ -2236,7 +2236,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2250,7 +2250,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2285,11 +2285,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2345,16 +2351,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2424,7 +2420,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2439,7 +2434,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2476,17 +2471,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2628,7 +2625,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2641,7 +2637,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2661,7 +2657,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2687,143 +2689,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2845,7 +2719,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2859,7 +2733,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2894,11 +2768,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2954,16 +2834,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3033,7 +2903,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3048,7 +2917,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3085,17 +2954,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3237,7 +3108,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3250,7 +3120,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3270,7 +3140,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3296,143 +3172,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3454,7 +3202,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3468,7 +3216,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3503,11 +3251,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3564,16 +3318,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3643,7 +3387,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3658,7 +3401,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3697,17 +3440,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3849,7 +3594,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3862,7 +3606,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3882,7 +3626,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3908,143 +3658,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4066,7 +3688,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4081,7 +3703,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4120,11 +3742,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4189,16 +3817,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4276,7 +3894,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4292,7 +3909,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4330,17 +3947,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4494,7 +4113,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4508,7 +4126,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4529,7 +4147,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4556,7 +4180,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4564,147 +4188,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4715,7 +4209,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4729,7 +4223,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4764,11 +4258,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4824,16 +4324,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4903,7 +4393,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4918,7 +4407,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4954,17 +4443,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5106,7 +4597,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5119,7 +4609,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5139,7 +4629,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5165,143 +4661,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5807,7 +5173,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5826,7 +5192,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5873,11 +5239,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5926,16 +5298,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5978,7 +5340,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5992,7 +5353,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6083,17 +5444,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6158,7 +5521,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6174,7 +5536,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6191,7 +5553,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6216,137 +5582,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6369,7 +5608,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6386,7 +5625,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6427,11 +5666,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6479,16 +5724,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6540,7 +5775,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6554,7 +5788,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6633,17 +5867,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6724,7 +5960,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6740,7 +5975,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6757,7 +5992,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6782,138 +6021,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6936,7 +6048,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6953,7 +6065,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6994,11 +6106,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7047,16 +6165,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7108,7 +6216,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7122,7 +6229,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7198,17 +6305,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7290,7 +6399,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7306,7 +6414,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7323,7 +6431,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7348,138 +6460,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 cd3acd279..30c018291 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 @@ -2231,7 +2231,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2245,7 +2245,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2280,11 +2280,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2340,16 +2346,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2419,7 +2415,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2434,7 +2429,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2471,17 +2466,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2623,7 +2620,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2636,7 +2632,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2656,7 +2652,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2682,143 +2684,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2840,7 +2714,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2854,7 +2728,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2889,11 +2763,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2949,16 +2829,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3028,7 +2898,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3043,7 +2912,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3080,17 +2949,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3232,7 +3103,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3245,7 +3115,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3265,7 +3135,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3291,143 +3167,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3449,7 +3197,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3463,7 +3211,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3498,11 +3246,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3559,16 +3313,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3638,7 +3382,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3653,7 +3396,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3692,17 +3435,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3844,7 +3589,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3857,7 +3601,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3877,7 +3621,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3903,143 +3653,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4061,7 +3683,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4076,7 +3698,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4115,11 +3737,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4184,16 +3812,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4271,7 +3889,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4287,7 +3904,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4325,17 +3942,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4489,7 +4108,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4503,7 +4121,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4524,7 +4142,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4551,7 +4175,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4559,147 +4183,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4710,7 +4204,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4724,7 +4218,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4759,11 +4253,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4819,16 +4319,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4898,7 +4388,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4913,7 +4402,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4949,17 +4438,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5101,7 +4592,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5114,7 +4604,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5134,7 +4624,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5160,143 +4656,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5802,7 +5168,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5821,7 +5187,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5868,11 +5234,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5921,16 +5293,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5973,7 +5335,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5987,7 +5348,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6078,17 +5439,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6153,7 +5516,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6169,7 +5531,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6186,7 +5548,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6211,137 +5577,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6364,7 +5603,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6381,7 +5620,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6422,11 +5661,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6474,16 +5719,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6535,7 +5770,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6549,7 +5783,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6628,17 +5862,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6719,7 +5955,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6735,7 +5970,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6752,7 +5987,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6777,138 +6016,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6931,7 +6043,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6948,7 +6060,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6989,11 +6101,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7042,16 +6160,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7103,7 +6211,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7117,7 +6224,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7193,17 +6300,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7285,7 +6394,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7301,7 +6409,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7318,7 +6426,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7343,138 +6455,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 d39d6856d..9c3924ef9 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 @@ -2227,7 +2227,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2241,7 +2241,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2276,11 +2276,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2336,16 +2342,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2415,7 +2411,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2430,7 +2425,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2467,17 +2462,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2619,7 +2616,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2632,7 +2628,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2652,7 +2648,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2678,143 +2680,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2836,7 +2710,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2850,7 +2724,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2885,11 +2759,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2945,16 +2825,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3024,7 +2894,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3039,7 +2908,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3076,17 +2945,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3228,7 +3099,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3241,7 +3111,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3261,7 +3131,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3287,143 +3163,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3445,7 +3193,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3459,7 +3207,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3494,11 +3242,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3555,16 +3309,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3634,7 +3378,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3649,7 +3392,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3688,17 +3431,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3840,7 +3585,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3853,7 +3597,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3873,7 +3617,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3899,143 +3649,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4057,7 +3679,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4072,7 +3694,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4111,11 +3733,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4180,16 +3808,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4267,7 +3885,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4283,7 +3900,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4321,17 +3938,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4485,7 +4104,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4499,7 +4117,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4520,7 +4138,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4547,7 +4171,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4555,147 +4179,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4706,7 +4200,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4720,7 +4214,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4755,11 +4249,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4815,16 +4315,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4894,7 +4384,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4909,7 +4398,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4945,17 +4434,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5097,7 +4588,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5110,7 +4600,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5130,7 +4620,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5156,143 +4652,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5798,7 +5164,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5817,7 +5183,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5864,11 +5230,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5917,16 +5289,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5969,7 +5331,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5983,7 +5344,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6074,17 +5435,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6149,7 +5512,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6165,7 +5527,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6182,7 +5544,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6207,137 +5573,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6360,7 +5599,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6377,7 +5616,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6418,11 +5657,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6470,16 +5715,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6531,7 +5766,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6545,7 +5779,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6624,17 +5858,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6715,7 +5951,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6731,7 +5966,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6748,7 +5983,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6773,138 +6012,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6927,7 +6039,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6944,7 +6056,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6985,11 +6097,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7038,16 +6156,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7099,7 +6207,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7113,7 +6220,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7189,17 +6296,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7281,7 +6390,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7297,7 +6405,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7314,7 +6422,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7339,138 +6451,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true 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 92ee0f7f9..c7cb7bf06 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 @@ -2218,7 +2218,7 @@ private constructor( class PlanPhaseUsageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, @@ -2232,7 +2232,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -2267,11 +2267,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -2327,16 +2333,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -2406,7 +2402,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2421,7 +2416,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("usage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null @@ -2458,17 +2453,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("usage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -2610,7 +2607,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .planPhaseOrder() @@ -2623,7 +2619,7 @@ private constructor( fun build(): PlanPhaseUsageDiscountAdjustment = PlanPhaseUsageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -2643,7 +2639,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("usage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() planPhaseOrder() @@ -2669,143 +2671,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("usage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_DISCOUNT = of("usage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - USAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE_DISCOUNT -> Value.USAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USAGE_DISCOUNT -> Known.USAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2827,7 +2701,7 @@ private constructor( class PlanPhaseAmountDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, @@ -2841,7 +2715,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing amountDiscount: JsonField = JsonMissing.of(), @@ -2876,11 +2750,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given @@ -2936,16 +2816,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [amountDiscount]. * @@ -3015,7 +2885,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3030,7 +2899,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("amount_discount") private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null @@ -3067,17 +2936,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("amount_discount") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3219,7 +3090,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .amountDiscount() * .appliesToPriceIds() * .isInvoiceLevel() @@ -3232,7 +3102,7 @@ private constructor( fun build(): PlanPhaseAmountDiscountAdjustment = PlanPhaseAmountDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -3252,7 +3122,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("amount_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } amountDiscount() appliesToPriceIds() isInvoiceLevel() @@ -3278,143 +3154,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("amount_discount")) 1 else 0 + } + (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT_DISCOUNT = of("amount_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - AMOUNT_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3436,7 +3184,7 @@ private constructor( class PlanPhasePercentageDiscountAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, @@ -3450,7 +3198,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -3485,11 +3233,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -3546,16 +3300,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -3625,7 +3369,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3640,7 +3383,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null @@ -3679,17 +3422,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("percentage_discount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -3831,7 +3576,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .percentageDiscount() @@ -3844,7 +3588,7 @@ private constructor( fun build(): PlanPhasePercentageDiscountAdjustment = PlanPhasePercentageDiscountAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -3864,7 +3608,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("percentage_discount")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() percentageDiscount() @@ -3890,143 +3640,15 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { + if (it == JsonValue.from("percentage_discount")) 1 else 0 + } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE_DISCOUNT = of("percentage_discount") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - PERCENTAGE_DISCOUNT - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE_DISCOUNT, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4048,7 +3670,7 @@ private constructor( class PlanPhaseMinimumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val itemId: JsonField, @@ -4063,7 +3685,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4102,11 +3724,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("minimum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4171,16 +3799,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4258,7 +3876,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4274,7 +3891,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("minimum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var itemId: JsonField? = null @@ -4312,17 +3929,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("minimum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -4476,7 +4095,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .itemId() @@ -4490,7 +4108,7 @@ private constructor( fun build(): PlanPhaseMinimumAdjustment = PlanPhaseMinimumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -4511,7 +4129,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("minimum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() itemId() @@ -4538,7 +4162,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("minimum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + @@ -4546,147 +4170,17 @@ private constructor( (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + } - companion object { - - @JvmField val MINIMUM = of("minimum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MINIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MINIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MINIMUM -> Value.MINIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MINIMUM -> Known.MINIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + /* spotless:on */ override fun hashCode(): Int = hashCode @@ -4697,7 +4191,7 @@ private constructor( class PlanPhaseMaximumAdjustment private constructor( private val id: JsonField, - private val adjustmentType: JsonField, + private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, @@ -4711,7 +4205,7 @@ private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), @JsonProperty("adjustment_type") @ExcludeMissing - adjustmentType: JsonField = JsonMissing.of(), + adjustmentType: JsonValue = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing appliesToPriceIds: JsonField> = JsonMissing.of(), @@ -4746,11 +4240,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("maximum") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType(): JsonValue = adjustmentType /** * The price IDs that this adjustment applies to. @@ -4806,16 +4306,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [adjustmentType]. - * - * Unlike [adjustmentType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType(): JsonField = adjustmentType - /** * Returns the raw JSON value of [appliesToPriceIds]. * @@ -4885,7 +4375,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -4900,7 +4389,7 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null - private var adjustmentType: JsonField? = null + private var adjustmentType: JsonValue = JsonValue.from("maximum") private var appliesToPriceIds: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null @@ -4936,17 +4425,19 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - /** - * Sets [Builder.adjustmentType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. + * + * It is usually unnecessary to call this method because the field defaults to + * the following: + * ```java + * JsonValue.from("maximum") + * ``` * - * You should usually call [Builder.adjustmentType] with a well-typed - * [AdjustmentType] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun adjustmentType(adjustmentType: JsonField) = apply { + fun adjustmentType(adjustmentType: JsonValue) = apply { this.adjustmentType = adjustmentType } @@ -5088,7 +4579,6 @@ private constructor( * The following fields are required: * ```java * .id() - * .adjustmentType() * .appliesToPriceIds() * .isInvoiceLevel() * .maximumAmount() @@ -5101,7 +4591,7 @@ private constructor( fun build(): PlanPhaseMaximumAdjustment = PlanPhaseMaximumAdjustment( checkRequired("id", id), - checkRequired("adjustmentType", adjustmentType), + adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5121,7 +4611,13 @@ private constructor( } id() - adjustmentType().validate() + _adjustmentType().let { + if (it != JsonValue.from("maximum")) { + throw OrbInvalidDataException( + "'adjustmentType' is invalid, received $it" + ) + } + } appliesToPriceIds() isInvoiceLevel() maximumAmount() @@ -5147,143 +4643,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (adjustmentType.asKnown().getOrNull()?.validity() ?: 0) + + adjustmentType.let { if (it == JsonValue.from("maximum")) 1 else 0 } + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) - class AdjustmentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MAXIMUM = of("maximum") - - @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value)) - } - - /** An enum containing [AdjustmentType]'s known values. */ - enum class Known { - MAXIMUM - } - - /** - * An enum containing [AdjustmentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AdjustmentType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MAXIMUM, - /** - * An enum member indicating that [AdjustmentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAXIMUM -> Value.MAXIMUM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - MAXIMUM -> Known.MAXIMUM - else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): AdjustmentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5789,7 +5155,7 @@ private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val additionalProperties: MutableMap, @@ -5808,7 +5174,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -5855,11 +5221,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("amount") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -5908,16 +5280,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -5960,7 +5322,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -5974,7 +5335,7 @@ private constructor( private var amountDiscount: JsonField? = null private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("amount") private var endDate: JsonField? = null private var startDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6065,17 +5426,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("amount") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6140,7 +5503,6 @@ private constructor( * .amountDiscount() * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * ``` @@ -6156,7 +5518,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), additionalProperties.toMutableMap(), @@ -6173,7 +5535,11 @@ private constructor( amountDiscount() appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("amount")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() validated = true @@ -6198,137 +5564,10 @@ private constructor( (if (amountDiscount.asKnown().isPresent) 1 else 0) + (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("amount")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMOUNT = of("amount") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - AMOUNT - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AMOUNT, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AMOUNT -> Value.AMOUNT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AMOUNT -> Known.AMOUNT - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6351,7 +5590,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val percentageDiscount: JsonField, private val startDate: JsonField, @@ -6368,7 +5607,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6409,11 +5648,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -6461,16 +5706,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -6522,7 +5757,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6536,7 +5770,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("percentage") private var endDate: JsonField? = null private var percentageDiscount: JsonField? = null private var startDate: JsonField? = null @@ -6615,17 +5849,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("percentage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -6706,7 +5942,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .percentageDiscount() * .startDate() @@ -6722,7 +5957,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("percentageDiscount", percentageDiscount), checkRequired("startDate", startDate), @@ -6739,7 +5974,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("percentage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() percentageDiscount() startDate() @@ -6764,138 +6003,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("percentage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PERCENTAGE = of("percentage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - PERCENTAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PERCENTAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PERCENTAGE -> Value.PERCENTAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PERCENTAGE -> Known.PERCENTAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6918,7 +6030,7 @@ private constructor( private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, - private val discountType: JsonField, + private val discountType: JsonValue, private val endDate: JsonField, private val startDate: JsonField, private val usageDiscount: JsonField, @@ -6935,7 +6047,7 @@ private constructor( appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing - discountType: JsonField = JsonMissing.of(), + discountType: JsonValue = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), @@ -6976,11 +6088,17 @@ private constructor( appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** - * @throws OrbInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * Expected to always return the following: + * ```java + * JsonValue.from("usage") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server + * responded with an unexpected value). */ - fun discountType(): DiscountType = discountType.getRequired("discount_type") + @JsonProperty("discount_type") + @ExcludeMissing + fun _discountType(): JsonValue = discountType /** * The end date of the discount interval. @@ -7029,16 +6147,6 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds(): JsonField> = appliesToPriceIntervalIds - /** - * Returns the raw JSON value of [discountType]. - * - * Unlike [discountType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discount_type") - @ExcludeMissing - fun _discountType(): JsonField = discountType - /** * Returns the raw JSON value of [endDate]. * @@ -7090,7 +6198,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7104,7 +6211,7 @@ private constructor( private var appliesToPriceIds: JsonField>? = null private var appliesToPriceIntervalIds: JsonField>? = null - private var discountType: JsonField? = null + private var discountType: JsonValue = JsonValue.from("usage") private var endDate: JsonField? = null private var startDate: JsonField? = null private var usageDiscount: JsonField? = null @@ -7180,17 +6287,19 @@ private constructor( } } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - /** - * Sets [Builder.discountType] to an arbitrary JSON value. + * Sets the field to an arbitrary JSON value. * - * You should usually call [Builder.discountType] with a well-typed [DiscountType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * It is usually unnecessary to call this method because the field defaults to the + * following: + * ```java + * JsonValue.from("usage") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun discountType(discountType: JsonField) = apply { + fun discountType(discountType: JsonValue) = apply { this.discountType = discountType } @@ -7272,7 +6381,6 @@ private constructor( * ```java * .appliesToPriceIds() * .appliesToPriceIntervalIds() - * .discountType() * .endDate() * .startDate() * .usageDiscount() @@ -7288,7 +6396,7 @@ private constructor( checkRequired("appliesToPriceIntervalIds", appliesToPriceIntervalIds).map { it.toImmutable() }, - checkRequired("discountType", discountType), + discountType, checkRequired("endDate", endDate), checkRequired("startDate", startDate), checkRequired("usageDiscount", usageDiscount), @@ -7305,7 +6413,11 @@ private constructor( appliesToPriceIds() appliesToPriceIntervalIds() - discountType().validate() + _discountType().let { + if (it != JsonValue.from("usage")) { + throw OrbInvalidDataException("'discountType' is invalid, received $it") + } + } endDate() startDate() usageDiscount() @@ -7330,138 +6442,11 @@ private constructor( internal fun validity(): Int = (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (appliesToPriceIntervalIds.asKnown().getOrNull()?.size ?: 0) + - (discountType.asKnown().getOrNull()?.validity() ?: 0) + + discountType.let { if (it == JsonValue.from("usage")) 1 else 0 } + (if (endDate.asKnown().isPresent) 1 else 0) + (if (startDate.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) - class DiscountType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE = of("usage") - - @JvmStatic fun of(value: String) = DiscountType(JsonField.of(value)) - } - - /** An enum containing [DiscountType]'s known values. */ - enum class Known { - USAGE - } - - /** - * An enum containing [DiscountType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DiscountType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - USAGE, - /** - * An enum member indicating that [DiscountType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USAGE -> Value.USAGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USAGE -> Known.USAGE - else -> throw OrbInvalidDataException("Unknown DiscountType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws OrbInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - OrbInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DiscountType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DiscountType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt index 67a6283e6..714fdefff 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt @@ -33,10 +33,6 @@ internal class CouponCreateParamsTest { .isEqualTo( CouponCreateParams.Discount.ofNewCouponPercentage( CouponCreateParams.Discount.NewCouponPercentageDiscount.builder() - .discountType( - CouponCreateParams.Discount.NewCouponPercentageDiscount.DiscountType - .PERCENTAGE - ) .percentageDiscount(0.0) .build() ) @@ -60,10 +56,6 @@ internal class CouponCreateParamsTest { .isEqualTo( CouponCreateParams.Discount.ofNewCouponPercentage( CouponCreateParams.Discount.NewCouponPercentageDiscount.builder() - .discountType( - CouponCreateParams.Discount.NewCouponPercentageDiscount.DiscountType - .PERCENTAGE - ) .percentageDiscount(0.0) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt index 66de2ed25..8d6ed8158 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt @@ -98,7 +98,6 @@ internal class CustomerCostListByExternalIdResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -207,7 +206,6 @@ internal class CustomerCostListByExternalIdResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -326,7 +324,6 @@ internal class CustomerCostListByExternalIdResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt index df09c01fc..53f33b445 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt @@ -98,7 +98,6 @@ internal class CustomerCostListResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -207,7 +206,6 @@ internal class CustomerCostListResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -326,7 +324,6 @@ internal class CustomerCostListResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt index c6886211c..ec57e32de 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt @@ -70,10 +70,6 @@ internal class CustomerCreateParamsTest { .taxConfiguration( CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -150,11 +146,6 @@ internal class CustomerCreateParamsTest { .taxConfiguration( CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -234,11 +225,6 @@ internal class CustomerCreateParamsTest { CustomerCreateParams.TaxConfiguration.ofNewAvalara( CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt index 2d97e8245..b914f7374 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt @@ -18,12 +18,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -76,12 +70,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -120,12 +108,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -173,12 +155,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .build() ) ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt index 998e5f289..f9508d502 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt @@ -47,11 +47,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry @@ -121,11 +116,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry @@ -180,11 +170,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .EntryType - .DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry @@ -257,11 +242,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .EntryType - .DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry @@ -320,11 +300,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry @@ -399,12 +374,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .ExpirationChangeLedgerEntry - .EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse @@ -462,11 +431,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry - .EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry @@ -540,12 +504,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .CreditBlockExpiryLedgerEntry - .EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse @@ -598,10 +556,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.EntryType - .VOID - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.Metadata @@ -670,11 +624,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry - .EntryType - .VOID - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.Metadata @@ -730,11 +679,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry @@ -808,11 +752,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry @@ -870,11 +809,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .EntryType - .AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry @@ -944,11 +878,6 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .EntryType - .AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt index d0a1eee92..74e6fd5cc 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt @@ -18,12 +18,6 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -76,12 +70,6 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -120,12 +108,6 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -173,12 +155,6 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .build() ) ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt index c9c9cd39d..8b2c1ac9c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt @@ -43,9 +43,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.EntryType.INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.Metadata.builder() @@ -99,10 +96,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.Metadata @@ -152,9 +145,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.EntryType.DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.Metadata.builder() @@ -211,10 +201,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.EntryType - .DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.Metadata @@ -268,10 +254,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.Metadata @@ -331,11 +313,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry - .EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.Metadata @@ -387,10 +364,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.Metadata @@ -450,11 +423,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry - .EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry @@ -503,7 +471,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .entryStatus( CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.EntryStatus.COMMITTED ) - .entryType(CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.EntryType.VOID) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.Metadata.builder() @@ -558,9 +525,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.EntryType.VOID - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.Metadata.builder() @@ -612,10 +576,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.Metadata @@ -675,10 +635,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.Metadata @@ -731,9 +687,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.EntryType.AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.Metadata.builder() @@ -787,10 +740,6 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.EntryType - .AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.Metadata diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt index 40ee16c72..50d4e0205 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt @@ -45,11 +45,6 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry @@ -98,11 +93,6 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry @@ -154,11 +144,6 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt index 6b2210821..c30d302b4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt @@ -44,10 +44,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.Metadata @@ -108,10 +104,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.Metadata @@ -162,10 +154,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.EntryType - .DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.Metadata @@ -229,10 +217,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.EntryType - .DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.Metadata @@ -289,11 +273,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry @@ -356,11 +335,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry @@ -416,11 +390,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry @@ -482,11 +451,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry @@ -537,9 +501,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.EntryType.VOID - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.Metadata.builder() @@ -597,9 +558,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.EntryType.VOID - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.Metadata @@ -654,10 +612,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry.EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry.Metadata @@ -722,11 +676,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry @@ -781,10 +730,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.EntryType - .AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.Metadata @@ -845,10 +790,6 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.EntryType - .AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.Metadata diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt index 447881655..c72b97c18 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt @@ -41,10 +41,6 @@ internal class CustomerCreditLedgerListPageResponseTest { CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() @@ -87,10 +83,6 @@ internal class CustomerCreditLedgerListPageResponseTest { CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() @@ -136,10 +128,6 @@ internal class CustomerCreditLedgerListPageResponseTest { CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryType - .INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt index 0e452a165..536d143f9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt @@ -41,9 +41,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryType.INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() @@ -94,9 +91,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryType.INCREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() @@ -143,9 +137,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.DecrementLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.EntryType.DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.DecrementLedgerEntry.Metadata.builder() @@ -199,9 +190,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.DecrementLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.EntryType.DECREMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.DecrementLedgerEntry.Metadata.builder() @@ -253,10 +241,6 @@ internal class CustomerCreditLedgerListResponseTest { CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.Metadata.builder() @@ -313,10 +297,6 @@ internal class CustomerCreditLedgerListResponseTest { CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.EntryType - .EXPIRATION_CHANGE - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.Metadata @@ -367,10 +347,6 @@ internal class CustomerCreditLedgerListResponseTest { CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.Metadata.builder() @@ -426,10 +402,6 @@ internal class CustomerCreditLedgerListResponseTest { CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.EntryType - .CREDIT_BLOCK_EXPIRY - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.Metadata @@ -475,7 +447,6 @@ internal class CustomerCreditLedgerListResponseTest { .description("description") .endingBalance(0.0) .entryStatus(CustomerCreditLedgerListResponse.VoidLedgerEntry.EntryStatus.COMMITTED) - .entryType(CustomerCreditLedgerListResponse.VoidLedgerEntry.EntryType.VOID) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.VoidLedgerEntry.Metadata.builder() @@ -527,7 +498,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.VoidLedgerEntry.EntryStatus.COMMITTED ) - .entryType(CustomerCreditLedgerListResponse.VoidLedgerEntry.EntryType.VOID) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.VoidLedgerEntry.Metadata.builder() @@ -576,10 +546,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.Metadata.builder() @@ -635,10 +601,6 @@ internal class CustomerCreditLedgerListResponseTest { CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.EntryStatus .COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.EntryType - .VOID_INITIATED - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.Metadata.builder() @@ -688,9 +650,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.AmendmentLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.EntryType.AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.AmendmentLedgerEntry.Metadata.builder() @@ -741,9 +700,6 @@ internal class CustomerCreditLedgerListResponseTest { .entryStatus( CustomerCreditLedgerListResponse.AmendmentLedgerEntry.EntryStatus.COMMITTED ) - .entryType( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.EntryType.AMENDMENT - ) .ledgerSequenceNumber(0L) .metadata( CustomerCreditLedgerListResponse.AmendmentLedgerEntry.Metadata.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt index d94ab291d..a39f588e6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt @@ -75,11 +75,6 @@ internal class CustomerUpdateByExternalIdParamsTest { CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -169,12 +164,6 @@ internal class CustomerUpdateByExternalIdParamsTest { CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration - .NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -260,12 +249,6 @@ internal class CustomerUpdateByExternalIdParamsTest { CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration - .NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt index ff2724f91..7d6a3c575 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt @@ -71,10 +71,6 @@ internal class CustomerUpdateParamsTest { .taxConfiguration( CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -160,11 +156,6 @@ internal class CustomerUpdateParamsTest { .taxConfiguration( CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -243,11 +234,6 @@ internal class CustomerUpdateParamsTest { CustomerUpdateParams.TaxConfiguration.ofNewAvalara( CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) 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 d33b6b2a5..3c0375cd0 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 @@ -117,12 +117,6 @@ internal class InvoiceFetchUpcomingResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - InvoiceFetchUpcomingResponse.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -225,7 +219,6 @@ internal class InvoiceFetchUpcomingResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -267,12 +260,6 @@ internal class InvoiceFetchUpcomingResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -462,12 +449,6 @@ internal class InvoiceFetchUpcomingResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - InvoiceFetchUpcomingResponse.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -568,7 +549,6 @@ internal class InvoiceFetchUpcomingResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -608,11 +588,6 @@ internal class InvoiceFetchUpcomingResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -805,12 +780,6 @@ internal class InvoiceFetchUpcomingResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - InvoiceFetchUpcomingResponse.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -913,7 +882,6 @@ internal class InvoiceFetchUpcomingResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -955,12 +923,6 @@ internal class InvoiceFetchUpcomingResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt index 9e4c6a5ce..8db2bcf8b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt @@ -22,11 +22,6 @@ internal class InvoiceLineItemCreateResponseTest { InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -125,7 +120,6 @@ internal class InvoiceLineItemCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -160,9 +154,6 @@ internal class InvoiceLineItemCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.Type.MATRIX - ) .build() ) .subtotal("9.00") @@ -184,11 +175,6 @@ internal class InvoiceLineItemCreateResponseTest { InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -296,7 +282,6 @@ internal class InvoiceLineItemCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -335,9 +320,6 @@ internal class InvoiceLineItemCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.Type.MATRIX - ) .build() ) ) @@ -365,11 +347,6 @@ internal class InvoiceLineItemCreateResponseTest { InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -468,7 +445,6 @@ internal class InvoiceLineItemCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -503,9 +479,6 @@ internal class InvoiceLineItemCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.Type.MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt index a784bdda1..f1d257ccc 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt @@ -118,12 +118,6 @@ internal class InvoiceListPageResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -240,7 +234,6 @@ internal class InvoiceListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -280,10 +273,6 @@ internal class InvoiceListPageResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -455,11 +444,6 @@ internal class InvoiceListPageResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -568,7 +552,6 @@ internal class InvoiceListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -605,9 +588,6 @@ internal class InvoiceListPageResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type.MATRIX - ) .build() ) .subtotal("9.00") @@ -786,12 +766,6 @@ internal class InvoiceListPageResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -908,7 +882,6 @@ internal class InvoiceListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -948,10 +921,6 @@ internal class InvoiceListPageResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") 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 7cd2f569c..d14f9a247 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 @@ -107,11 +107,6 @@ internal class InvoiceTest { .addAdjustment( Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -214,7 +209,6 @@ internal class InvoiceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -251,7 +245,6 @@ internal class InvoiceTest { ) .name("Tier One") .quantity(5.0) - .type(Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type.MATRIX) .build() ) .subtotal("9.00") @@ -424,11 +417,6 @@ internal class InvoiceTest { .addAdjustment( Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -529,7 +517,6 @@ internal class InvoiceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -565,7 +552,6 @@ internal class InvoiceTest { ) .name("Tier One") .quantity(5.0) - .type(Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type.MATRIX) .build() ) .subtotal("9.00") @@ -739,11 +725,6 @@ internal class InvoiceTest { .addAdjustment( Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -846,7 +827,6 @@ internal class InvoiceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -883,7 +863,6 @@ internal class InvoiceTest { ) .name("Tier One") .quantity(5.0) - .type(Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type.MATRIX) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt index e6aa97698..cdc2093d2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt @@ -17,7 +17,6 @@ internal class PlanCreateParamsTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() @@ -81,7 +80,6 @@ internal class PlanCreateParamsTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() @@ -147,7 +145,6 @@ internal class PlanCreateParamsTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() @@ -215,7 +212,6 @@ internal class PlanCreateParamsTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() @@ -236,7 +232,6 @@ internal class PlanCreateParamsTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt index b10f75a9b..4a303159a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt @@ -21,10 +21,6 @@ internal class PlanListPageResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -174,7 +170,6 @@ internal class PlanListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -220,10 +215,6 @@ internal class PlanListPageResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -371,7 +362,6 @@ internal class PlanListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -420,10 +410,6 @@ internal class PlanListPageResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -573,7 +559,6 @@ internal class PlanListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt index 754261794..b5393d513 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt @@ -20,10 +20,6 @@ internal class PlanTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -169,7 +165,6 @@ internal class PlanTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -207,10 +202,6 @@ internal class PlanTest { Plan.Adjustment.ofPlanPhaseUsageDiscount( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -367,7 +358,6 @@ internal class PlanTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -411,10 +401,6 @@ internal class PlanTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -560,7 +546,6 @@ internal class PlanTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt index 2d960c9c3..abfb46074 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt @@ -16,7 +16,6 @@ internal class PriceCreateParamsTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() @@ -72,7 +71,6 @@ internal class PriceCreateParamsTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() @@ -127,7 +125,6 @@ internal class PriceCreateParamsTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() @@ -183,7 +180,6 @@ internal class PriceCreateParamsTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() @@ -203,7 +199,6 @@ internal class PriceCreateParamsTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt index ce5171b1d..30c2d5f26 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt @@ -76,7 +76,6 @@ internal class PriceListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -159,7 +158,6 @@ internal class PriceListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -245,7 +243,6 @@ internal class PriceListPageResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt index 3d2e7872b..6647ea493 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt @@ -74,7 +74,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -184,7 +183,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -267,7 +265,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.PackagePrice.ModelType.PACKAGE) .name("name") .packageConfig( Price.PackagePrice.PackageConfig.builder() @@ -382,7 +379,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.PackagePrice.ModelType.PACKAGE) .name("name") .packageConfig( Price.PackagePrice.PackageConfig.builder() @@ -480,7 +476,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MatrixPrice.ModelType.MATRIX) .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixPrice.PriceType.USAGE_PRICE) @@ -601,7 +596,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MatrixPrice.ModelType.MATRIX) .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixPrice.PriceType.USAGE_PRICE) @@ -681,7 +675,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredPrice.ModelType.TIERED) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPrice.PriceType.USAGE_PRICE) @@ -801,7 +794,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredPrice.ModelType.TIERED) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPrice.PriceType.USAGE_PRICE) @@ -894,7 +886,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredBpsPrice.ModelType.TIERED_BPS) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredBpsPrice.PriceType.USAGE_PRICE) @@ -1015,7 +1006,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredBpsPrice.ModelType.TIERED_BPS) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredBpsPrice.PriceType.USAGE_PRICE) @@ -1111,7 +1101,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BpsPrice.ModelType.BPS) .name("name") .planPhaseOrder(0L) .priceType(Price.BpsPrice.PriceType.USAGE_PRICE) @@ -1224,7 +1213,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BpsPrice.ModelType.BPS) .name("name") .planPhaseOrder(0L) .priceType(Price.BpsPrice.PriceType.USAGE_PRICE) @@ -1315,7 +1303,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BulkBpsPrice.ModelType.BULK_BPS) .name("name") .planPhaseOrder(0L) .priceType(Price.BulkBpsPrice.PriceType.USAGE_PRICE) @@ -1435,7 +1422,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BulkBpsPrice.ModelType.BULK_BPS) .name("name") .planPhaseOrder(0L) .priceType(Price.BulkBpsPrice.PriceType.USAGE_PRICE) @@ -1523,7 +1509,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BulkPrice.ModelType.BULK) .name("name") .planPhaseOrder(0L) .priceType(Price.BulkPrice.PriceType.USAGE_PRICE) @@ -1642,7 +1627,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BulkPrice.ModelType.BULK) .name("name") .planPhaseOrder(0L) .priceType(Price.BulkPrice.PriceType.USAGE_PRICE) @@ -1728,7 +1712,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.ThresholdTotalAmountPrice.ModelType.THRESHOLD_TOTAL_AMOUNT) .name("name") .planPhaseOrder(0L) .priceType(Price.ThresholdTotalAmountPrice.PriceType.USAGE_PRICE) @@ -1850,7 +1833,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.ThresholdTotalAmountPrice.ModelType.THRESHOLD_TOTAL_AMOUNT) .name("name") .planPhaseOrder(0L) .priceType(Price.ThresholdTotalAmountPrice.PriceType.USAGE_PRICE) @@ -1937,7 +1919,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredPackagePrice.ModelType.TIERED_PACKAGE) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackagePrice.PriceType.USAGE_PRICE) @@ -2054,7 +2035,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredPackagePrice.ModelType.TIERED_PACKAGE) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackagePrice.PriceType.USAGE_PRICE) @@ -2146,7 +2126,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.GroupedTieredPrice.ModelType.GROUPED_TIERED) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTieredPrice.PriceType.USAGE_PRICE) @@ -2263,7 +2242,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.GroupedTieredPrice.ModelType.GROUPED_TIERED) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTieredPrice.PriceType.USAGE_PRICE) @@ -2348,7 +2326,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredWithMinimumPrice.ModelType.TIERED_WITH_MINIMUM) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithMinimumPrice.PriceType.USAGE_PRICE) @@ -2467,7 +2444,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredWithMinimumPrice.ModelType.TIERED_WITH_MINIMUM) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithMinimumPrice.PriceType.USAGE_PRICE) @@ -2562,9 +2538,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.TieredPackageWithMinimumPrice.ModelType.TIERED_PACKAGE_WITH_MINIMUM - ) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackageWithMinimumPrice.PriceType.USAGE_PRICE) @@ -2691,9 +2664,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.TieredPackageWithMinimumPrice.ModelType.TIERED_PACKAGE_WITH_MINIMUM - ) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackageWithMinimumPrice.PriceType.USAGE_PRICE) @@ -2785,7 +2755,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.PackageWithAllocationPrice.ModelType.PACKAGE_WITH_ALLOCATION) .name("name") .packageWithAllocationConfig( Price.PackageWithAllocationPrice.PackageWithAllocationConfig.builder() @@ -2910,7 +2879,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.PackageWithAllocationPrice.ModelType.PACKAGE_WITH_ALLOCATION) .name("name") .packageWithAllocationConfig( Price.PackageWithAllocationPrice.PackageWithAllocationConfig.builder() @@ -2999,7 +2967,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitWithPercentPrice.ModelType.UNIT_WITH_PERCENT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithPercentPrice.PriceType.USAGE_PRICE) @@ -3117,7 +3084,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitWithPercentPrice.ModelType.UNIT_WITH_PERCENT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithPercentPrice.PriceType.USAGE_PRICE) @@ -3222,7 +3188,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MatrixWithAllocationPrice.ModelType.MATRIX_WITH_ALLOCATION) .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithAllocationPrice.PriceType.USAGE_PRICE) @@ -3354,7 +3319,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MatrixWithAllocationPrice.ModelType.MATRIX_WITH_ALLOCATION) .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithAllocationPrice.PriceType.USAGE_PRICE) @@ -3440,7 +3404,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredWithProrationPrice.ModelType.TIERED_WITH_PRORATION) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithProrationPrice.PriceType.USAGE_PRICE) @@ -3562,7 +3525,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.TieredWithProrationPrice.ModelType.TIERED_WITH_PRORATION) .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithProrationPrice.PriceType.USAGE_PRICE) @@ -3652,7 +3614,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitWithProrationPrice.ModelType.UNIT_WITH_PRORATION) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithProrationPrice.PriceType.USAGE_PRICE) @@ -3771,7 +3732,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitWithProrationPrice.ModelType.UNIT_WITH_PRORATION) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithProrationPrice.PriceType.USAGE_PRICE) @@ -3866,7 +3826,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.GroupedAllocationPrice.ModelType.GROUPED_ALLOCATION) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedAllocationPrice.PriceType.USAGE_PRICE) @@ -3985,7 +3944,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.GroupedAllocationPrice.ModelType.GROUPED_ALLOCATION) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedAllocationPrice.PriceType.USAGE_PRICE) @@ -4083,9 +4041,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.GroupedWithProratedMinimumPrice.ModelType.GROUPED_WITH_PRORATED_MINIMUM - ) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithProratedMinimumPrice.PriceType.USAGE_PRICE) @@ -4213,10 +4168,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.GroupedWithProratedMinimumPrice.ModelType - .GROUPED_WITH_PRORATED_MINIMUM - ) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithProratedMinimumPrice.PriceType.USAGE_PRICE) @@ -4315,9 +4266,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.GroupedWithMeteredMinimumPrice.ModelType.GROUPED_WITH_METERED_MINIMUM - ) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithMeteredMinimumPrice.PriceType.USAGE_PRICE) @@ -4445,9 +4393,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.GroupedWithMeteredMinimumPrice.ModelType.GROUPED_WITH_METERED_MINIMUM - ) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithMeteredMinimumPrice.PriceType.USAGE_PRICE) @@ -4539,7 +4484,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MatrixWithDisplayNamePrice.ModelType.MATRIX_WITH_DISPLAY_NAME) .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithDisplayNamePrice.PriceType.USAGE_PRICE) @@ -4664,7 +4608,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MatrixWithDisplayNamePrice.ModelType.MATRIX_WITH_DISPLAY_NAME) .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithDisplayNamePrice.PriceType.USAGE_PRICE) @@ -4754,7 +4697,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BulkWithProrationPrice.ModelType.BULK_WITH_PRORATION) .name("name") .planPhaseOrder(0L) .priceType(Price.BulkWithProrationPrice.PriceType.USAGE_PRICE) @@ -4873,7 +4815,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.BulkWithProrationPrice.ModelType.BULK_WITH_PRORATION) .name("name") .planPhaseOrder(0L) .priceType(Price.BulkWithProrationPrice.PriceType.USAGE_PRICE) @@ -4964,7 +4905,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.GroupedTieredPackagePrice.ModelType.GROUPED_TIERED_PACKAGE) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTieredPackagePrice.PriceType.USAGE_PRICE) @@ -5086,7 +5026,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.GroupedTieredPackagePrice.ModelType.GROUPED_TIERED_PACKAGE) .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTieredPackagePrice.PriceType.USAGE_PRICE) @@ -5178,7 +5117,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MaxGroupTieredPackagePrice.ModelType.MAX_GROUP_TIERED_PACKAGE) .name("name") .planPhaseOrder(0L) .priceType(Price.MaxGroupTieredPackagePrice.PriceType.USAGE_PRICE) @@ -5303,7 +5241,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.MaxGroupTieredPackagePrice.ModelType.MAX_GROUP_TIERED_PACKAGE) .name("name") .planPhaseOrder(0L) .priceType(Price.MaxGroupTieredPackagePrice.PriceType.USAGE_PRICE) @@ -5398,10 +5335,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.ScalableMatrixWithUnitPricingPrice.ModelType - .SCALABLE_MATRIX_WITH_UNIT_PRICING - ) .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithUnitPricingPrice.PriceType.USAGE_PRICE) @@ -5530,10 +5463,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.ScalableMatrixWithUnitPricingPrice.ModelType - .SCALABLE_MATRIX_WITH_UNIT_PRICING - ) .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithUnitPricingPrice.PriceType.USAGE_PRICE) @@ -5635,10 +5564,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.ScalableMatrixWithTieredPricingPrice.ModelType - .SCALABLE_MATRIX_WITH_TIERED_PRICING - ) .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithTieredPricingPrice.PriceType.USAGE_PRICE) @@ -5771,10 +5696,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType( - Price.ScalableMatrixWithTieredPricingPrice.ModelType - .SCALABLE_MATRIX_WITH_TIERED_PRICING - ) .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithTieredPricingPrice.PriceType.USAGE_PRICE) @@ -5874,7 +5795,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.CumulativeGroupedBulkPrice.ModelType.CUMULATIVE_GROUPED_BULK) .name("name") .planPhaseOrder(0L) .priceType(Price.CumulativeGroupedBulkPrice.PriceType.USAGE_PRICE) @@ -5999,7 +5919,6 @@ internal class PriceTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.CumulativeGroupedBulkPrice.ModelType.CUMULATIVE_GROUPED_BULK) .name("name") .planPhaseOrder(0L) .priceType(Price.CumulativeGroupedBulkPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt index 1bf45e539..f8f0bd863 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt @@ -25,12 +25,6 @@ internal class SubscriptionCancelResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionCancelResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -147,11 +141,6 @@ internal class SubscriptionCancelResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionCancelResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -199,10 +188,6 @@ internal class SubscriptionCancelResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -352,7 +337,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -471,7 +455,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -703,12 +686,6 @@ internal class SubscriptionCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -834,7 +811,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -878,11 +854,6 @@ internal class SubscriptionCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1148,12 +1119,6 @@ internal class SubscriptionCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1279,7 +1244,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1323,11 +1287,6 @@ internal class SubscriptionCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1413,12 +1372,6 @@ internal class SubscriptionCancelResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionCancelResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1541,11 +1494,6 @@ internal class SubscriptionCancelResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionCancelResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1601,10 +1549,6 @@ internal class SubscriptionCancelResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1752,7 +1696,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1866,7 +1809,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2093,12 +2035,6 @@ internal class SubscriptionCancelResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2220,7 +2156,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2262,10 +2197,6 @@ internal class SubscriptionCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2519,12 +2450,6 @@ internal class SubscriptionCancelResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2646,7 +2571,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2688,10 +2612,6 @@ internal class SubscriptionCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2779,12 +2699,6 @@ internal class SubscriptionCancelResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionCancelResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2901,11 +2815,6 @@ internal class SubscriptionCancelResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionCancelResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2953,10 +2862,6 @@ internal class SubscriptionCancelResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3106,7 +3011,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3225,7 +3129,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3457,12 +3360,6 @@ internal class SubscriptionCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3588,7 +3485,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3632,11 +3528,6 @@ internal class SubscriptionCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3902,12 +3793,6 @@ internal class SubscriptionCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4033,7 +3918,6 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4077,11 +3961,6 @@ internal class SubscriptionCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt index 28d0ad07f..e97395969 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt @@ -32,14 +32,6 @@ internal class SubscriptionChangeApplyResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeApplyResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -165,12 +157,6 @@ internal class SubscriptionChangeApplyResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeApplyResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -222,11 +208,6 @@ internal class SubscriptionChangeApplyResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -392,7 +373,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -530,7 +510,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -788,12 +767,6 @@ internal class SubscriptionChangeApplyResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -933,7 +906,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -985,12 +957,6 @@ internal class SubscriptionChangeApplyResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1295,12 +1261,6 @@ internal class SubscriptionChangeApplyResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1440,7 +1400,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -1492,12 +1451,6 @@ internal class SubscriptionChangeApplyResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1610,14 +1563,6 @@ internal class SubscriptionChangeApplyResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeApplyResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1738,12 +1683,6 @@ internal class SubscriptionChangeApplyResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeApplyResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1795,11 +1734,6 @@ internal class SubscriptionChangeApplyResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1957,7 +1891,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2083,7 +2016,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2324,12 +2256,6 @@ internal class SubscriptionChangeApplyResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2459,7 +2385,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -2509,12 +2434,6 @@ internal class SubscriptionChangeApplyResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2799,12 +2718,6 @@ internal class SubscriptionChangeApplyResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2934,7 +2847,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -2984,12 +2896,6 @@ internal class SubscriptionChangeApplyResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3102,14 +3008,6 @@ internal class SubscriptionChangeApplyResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeApplyResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3235,12 +3133,6 @@ internal class SubscriptionChangeApplyResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeApplyResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -3292,11 +3184,6 @@ internal class SubscriptionChangeApplyResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3462,7 +3349,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3600,7 +3486,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3858,12 +3743,6 @@ internal class SubscriptionChangeApplyResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4003,7 +3882,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -4055,12 +3933,6 @@ internal class SubscriptionChangeApplyResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -4365,12 +4237,6 @@ internal class SubscriptionChangeApplyResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4510,7 +4376,6 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -4562,12 +4427,6 @@ internal class SubscriptionChangeApplyResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt index d140d9eb4..b4ff77259 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt @@ -32,14 +32,6 @@ internal class SubscriptionChangeCancelResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeCancelResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -165,12 +157,6 @@ internal class SubscriptionChangeCancelResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeCancelResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -222,11 +208,6 @@ internal class SubscriptionChangeCancelResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -392,7 +373,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -530,7 +510,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -788,12 +767,6 @@ internal class SubscriptionChangeCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -933,7 +906,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -985,12 +957,6 @@ internal class SubscriptionChangeCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1295,12 +1261,6 @@ internal class SubscriptionChangeCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1440,7 +1400,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -1492,12 +1451,6 @@ internal class SubscriptionChangeCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1610,14 +1563,6 @@ internal class SubscriptionChangeCancelResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeCancelResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1739,12 +1684,6 @@ internal class SubscriptionChangeCancelResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeCancelResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1796,11 +1735,6 @@ internal class SubscriptionChangeCancelResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1958,7 +1892,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2084,7 +2017,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2325,12 +2257,6 @@ internal class SubscriptionChangeCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2460,7 +2386,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -2510,12 +2435,6 @@ internal class SubscriptionChangeCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2800,12 +2719,6 @@ internal class SubscriptionChangeCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2935,7 +2848,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -2985,12 +2897,6 @@ internal class SubscriptionChangeCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3103,14 +3009,6 @@ internal class SubscriptionChangeCancelResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeCancelResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3236,12 +3134,6 @@ internal class SubscriptionChangeCancelResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeCancelResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -3293,11 +3185,6 @@ internal class SubscriptionChangeCancelResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3463,7 +3350,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3601,7 +3487,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3859,12 +3744,6 @@ internal class SubscriptionChangeCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4004,7 +3883,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -4056,12 +3934,6 @@ internal class SubscriptionChangeCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -4366,12 +4238,6 @@ internal class SubscriptionChangeCancelResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4511,7 +4377,6 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -4563,12 +4428,6 @@ internal class SubscriptionChangeCancelResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt index c3209a160..be8d5ee89 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt @@ -33,14 +33,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeRetrieveResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -166,12 +158,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -226,11 +212,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -396,7 +377,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -534,7 +514,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -793,12 +772,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -938,7 +911,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -990,12 +962,6 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1300,12 +1266,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1445,7 +1405,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -1497,12 +1456,6 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1615,14 +1568,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeRetrieveResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1744,12 +1689,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1801,11 +1740,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1963,7 +1897,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2089,7 +2022,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2330,12 +2262,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2465,7 +2391,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -2515,12 +2440,6 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2805,12 +2724,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2940,7 +2853,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -2990,12 +2902,6 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3109,14 +3015,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionChangeRetrieveResponse.Subscription - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3242,12 +3140,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -3302,11 +3194,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3472,7 +3359,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3610,7 +3496,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3869,12 +3754,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4014,7 +3893,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -4066,12 +3944,6 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -4376,12 +4248,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4521,7 +4387,6 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType( @@ -4573,12 +4438,6 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt index bcbca74bd..6cb974090 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt @@ -18,12 +18,6 @@ internal class SubscriptionCreateParamsTest { .adjustment( SubscriptionCreateParams.AddAdjustment.Adjustment.NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -70,11 +64,6 @@ internal class SubscriptionCreateParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice @@ -180,12 +169,6 @@ internal class SubscriptionCreateParamsTest { .adjustment( SubscriptionCreateParams.ReplaceAdjustment.Adjustment.NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -233,11 +216,6 @@ internal class SubscriptionCreateParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice @@ -309,12 +287,6 @@ internal class SubscriptionCreateParamsTest { .adjustment( SubscriptionCreateParams.AddAdjustment.Adjustment.NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -364,11 +336,6 @@ internal class SubscriptionCreateParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice @@ -475,12 +442,6 @@ internal class SubscriptionCreateParamsTest { SubscriptionCreateParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -529,12 +490,6 @@ internal class SubscriptionCreateParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.ReplacePrice.Price @@ -608,12 +563,6 @@ internal class SubscriptionCreateParamsTest { .adjustment( SubscriptionCreateParams.AddAdjustment.Adjustment.NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -661,11 +610,6 @@ internal class SubscriptionCreateParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice @@ -779,12 +723,6 @@ internal class SubscriptionCreateParamsTest { .adjustment( SubscriptionCreateParams.ReplaceAdjustment.Adjustment.NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -833,11 +771,6 @@ internal class SubscriptionCreateParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt index ecec5b7ff..3c7563684 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt @@ -25,12 +25,6 @@ internal class SubscriptionCreateResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionCreateResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -147,11 +141,6 @@ internal class SubscriptionCreateResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionCreateResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -199,10 +188,6 @@ internal class SubscriptionCreateResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -352,7 +337,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -471,7 +455,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -703,12 +686,6 @@ internal class SubscriptionCreateResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -834,7 +811,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -878,11 +854,6 @@ internal class SubscriptionCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1148,12 +1119,6 @@ internal class SubscriptionCreateResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1279,7 +1244,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1323,11 +1287,6 @@ internal class SubscriptionCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1413,12 +1372,6 @@ internal class SubscriptionCreateResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionCreateResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1541,11 +1494,6 @@ internal class SubscriptionCreateResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionCreateResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1601,10 +1549,6 @@ internal class SubscriptionCreateResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1752,7 +1696,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1866,7 +1809,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2093,12 +2035,6 @@ internal class SubscriptionCreateResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2220,7 +2156,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2262,10 +2197,6 @@ internal class SubscriptionCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2519,12 +2450,6 @@ internal class SubscriptionCreateResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2646,7 +2571,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2688,10 +2612,6 @@ internal class SubscriptionCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2779,12 +2699,6 @@ internal class SubscriptionCreateResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionCreateResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2901,11 +2815,6 @@ internal class SubscriptionCreateResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionCreateResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2953,10 +2862,6 @@ internal class SubscriptionCreateResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3106,7 +3011,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3225,7 +3129,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3457,12 +3360,6 @@ internal class SubscriptionCreateResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3588,7 +3485,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3632,11 +3528,6 @@ internal class SubscriptionCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3902,12 +3793,6 @@ internal class SubscriptionCreateResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4033,7 +3918,6 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4077,11 +3961,6 @@ internal class SubscriptionCreateResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt index 1197b4f4a..413f38a85 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt @@ -98,7 +98,6 @@ internal class SubscriptionFetchCostsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -207,7 +206,6 @@ internal class SubscriptionFetchCostsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -326,7 +324,6 @@ internal class SubscriptionFetchCostsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt index 15c247f22..f6430d002 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt @@ -48,11 +48,6 @@ internal class SubscriptionPriceIntervalsParamsTest { ) .currency("currency") .itemId("item_id") - .modelType( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice @@ -114,12 +109,6 @@ internal class SubscriptionPriceIntervalsParamsTest { SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -209,11 +198,6 @@ internal class SubscriptionPriceIntervalsParamsTest { ) .currency("currency") .itemId("item_id") - .modelType( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice @@ -275,12 +259,6 @@ internal class SubscriptionPriceIntervalsParamsTest { SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -355,11 +333,6 @@ internal class SubscriptionPriceIntervalsParamsTest { ) .currency("currency") .itemId("item_id") - .modelType( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice @@ -422,12 +395,6 @@ internal class SubscriptionPriceIntervalsParamsTest { SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt index 8218d0f07..e17403f04 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt @@ -25,12 +25,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionPriceIntervalsResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -148,12 +142,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionPriceIntervalsResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -203,10 +191,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -356,7 +340,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -476,7 +459,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -708,12 +690,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -839,7 +815,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -883,11 +858,6 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1153,12 +1123,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1284,7 +1248,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1328,11 +1291,6 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1418,12 +1376,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionPriceIntervalsResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1548,12 +1500,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionPriceIntervalsResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1612,10 +1558,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1763,7 +1705,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1877,7 +1818,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2104,12 +2044,6 @@ internal class SubscriptionPriceIntervalsResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2231,7 +2165,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2273,10 +2206,6 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2530,12 +2459,6 @@ internal class SubscriptionPriceIntervalsResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2657,7 +2580,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2699,10 +2621,6 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2790,12 +2708,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionPriceIntervalsResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2913,12 +2825,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionPriceIntervalsResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2968,10 +2874,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3121,7 +3023,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3241,7 +3142,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3473,12 +3373,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3604,7 +3498,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3648,11 +3541,6 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3918,12 +3806,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4049,7 +3931,6 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4093,11 +3974,6 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt index 26015afe3..5af625122 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt @@ -21,12 +21,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -78,12 +72,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.AddPrice.Price @@ -187,12 +175,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -244,12 +226,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price @@ -340,12 +316,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -399,12 +369,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.AddPrice.Price @@ -508,13 +472,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.ReplaceAdjustment - .Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -568,12 +525,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price @@ -649,12 +600,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -707,12 +652,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.AddPrice.Price @@ -820,12 +759,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -878,12 +811,6 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt index f148f1a66..e24f9b864 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt @@ -25,13 +25,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionSchedulePlanChangeResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -149,12 +142,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionSchedulePlanChangeResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -204,10 +191,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -357,7 +340,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -477,7 +459,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -709,12 +690,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -840,7 +815,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -884,11 +858,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1154,12 +1123,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1285,7 +1248,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1329,11 +1291,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1419,12 +1376,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionSchedulePlanChangeResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1549,12 +1500,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionSchedulePlanChangeResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1613,10 +1558,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1764,7 +1705,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1879,7 +1819,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2106,12 +2045,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2233,7 +2166,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2275,10 +2207,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2532,12 +2460,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2659,7 +2581,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2701,10 +2622,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2792,13 +2709,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionSchedulePlanChangeResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2916,12 +2826,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionSchedulePlanChangeResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2971,10 +2875,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3124,7 +3024,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3244,7 +3143,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3476,12 +3374,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3607,7 +3499,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3651,11 +3542,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3921,12 +3807,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4052,7 +3932,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4096,11 +3975,6 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt index e286f5227..5db50c37d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt @@ -25,12 +25,6 @@ internal class SubscriptionTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -147,9 +141,6 @@ internal class SubscriptionTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - Subscription.DiscountInterval.AmountDiscountInterval.DiscountType.AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -197,10 +188,6 @@ internal class SubscriptionTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -350,7 +337,6 @@ internal class SubscriptionTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -468,7 +454,6 @@ internal class SubscriptionTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -515,12 +500,6 @@ internal class SubscriptionTest { Subscription.AdjustmentInterval.Adjustment.PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -643,9 +622,6 @@ internal class SubscriptionTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - Subscription.DiscountInterval.AmountDiscountInterval.DiscountType.AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -699,10 +675,6 @@ internal class SubscriptionTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -850,7 +822,6 @@ internal class SubscriptionTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -963,7 +934,6 @@ internal class SubscriptionTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1018,12 +988,6 @@ internal class SubscriptionTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1140,9 +1104,6 @@ internal class SubscriptionTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - Subscription.DiscountInterval.AmountDiscountInterval.DiscountType.AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1190,10 +1151,6 @@ internal class SubscriptionTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1343,7 +1300,6 @@ internal class SubscriptionTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1461,7 +1417,6 @@ internal class SubscriptionTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt index 6dcd43e4a..6eee7cfed 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt @@ -25,12 +25,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -148,11 +142,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionTriggerPhaseResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -202,10 +191,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -355,7 +340,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -475,7 +459,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -707,12 +690,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -838,7 +815,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -882,11 +858,6 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1152,12 +1123,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1283,7 +1248,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1327,11 +1291,6 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1417,12 +1376,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1547,11 +1500,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionTriggerPhaseResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1610,10 +1558,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1761,7 +1705,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1875,7 +1818,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2102,12 +2044,6 @@ internal class SubscriptionTriggerPhaseResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2229,7 +2165,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2271,10 +2206,6 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2528,12 +2459,6 @@ internal class SubscriptionTriggerPhaseResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2655,7 +2580,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2697,10 +2621,6 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2788,12 +2708,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2911,11 +2825,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionTriggerPhaseResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2965,10 +2874,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3118,7 +3023,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3238,7 +3142,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3470,12 +3373,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3601,7 +3498,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3645,11 +3541,6 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3915,12 +3806,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4046,7 +3931,6 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4090,11 +3974,6 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt index 2b1a5fdf3..5061da066 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt @@ -25,13 +25,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnscheduleCancellationResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -151,12 +144,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnscheduleCancellationResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -206,10 +193,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -359,7 +342,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -479,7 +461,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -711,12 +692,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -842,7 +817,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -886,11 +860,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1156,12 +1125,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1287,7 +1250,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1331,11 +1293,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1421,13 +1378,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnscheduleCancellationResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1553,12 +1503,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnscheduleCancellationResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1617,10 +1561,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1768,7 +1708,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1883,7 +1822,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2110,12 +2048,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2237,7 +2169,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2279,10 +2210,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2536,12 +2463,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2663,7 +2584,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2705,10 +2625,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2796,13 +2712,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnscheduleCancellationResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2922,12 +2831,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnscheduleCancellationResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2977,10 +2880,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3130,7 +3029,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3250,7 +3148,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3482,12 +3379,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3613,7 +3504,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3657,11 +3547,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3927,12 +3812,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4058,7 +3937,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4102,11 +3980,6 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt index 3133426a1..eeeba5c7b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt @@ -27,14 +27,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -155,12 +147,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -212,10 +198,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -365,7 +347,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -485,7 +466,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -717,12 +697,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -848,7 +822,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -892,11 +865,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1162,12 +1130,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1293,7 +1255,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1337,11 +1298,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1429,14 +1385,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1574,12 +1522,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1642,10 +1584,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1793,7 +1731,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1908,7 +1845,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2135,12 +2071,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2262,7 +2192,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2304,10 +2233,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2561,12 +2486,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2688,7 +2607,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2730,10 +2648,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2823,14 +2737,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2951,12 +2857,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -3008,10 +2908,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3161,7 +3057,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3281,7 +3176,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3513,12 +3407,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3644,7 +3532,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3688,11 +3575,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3958,12 +3840,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4089,7 +3965,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4133,11 +4008,6 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt index e743458f6..bcfe38c07 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt @@ -26,14 +26,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnschedulePendingPlanChangesResponse - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -153,12 +145,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -210,10 +196,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -363,7 +345,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -483,7 +464,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -715,12 +695,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -846,7 +820,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -890,11 +863,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1160,12 +1128,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1291,7 +1253,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1335,11 +1296,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1427,13 +1383,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnschedulePendingPlanChangesResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1562,12 +1511,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1626,10 +1569,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1777,7 +1716,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1892,7 +1830,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2119,12 +2056,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2246,7 +2177,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2288,10 +2218,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2545,12 +2471,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2672,7 +2592,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2714,10 +2633,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2806,14 +2721,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUnschedulePendingPlanChangesResponse - .AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2933,12 +2840,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2990,10 +2891,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3143,7 +3040,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3263,7 +3159,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3495,12 +3390,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3626,7 +3515,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3670,11 +3558,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3940,12 +3823,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4071,7 +3948,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4115,11 +3991,6 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt index dc0a8f116..9069046e5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt @@ -25,13 +25,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUpdateFixedFeeQuantityResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -151,12 +144,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -206,10 +193,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -359,7 +342,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -479,7 +461,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -711,12 +692,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -842,7 +817,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -886,11 +860,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1156,12 +1125,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1287,7 +1250,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1331,11 +1293,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1421,13 +1378,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUpdateFixedFeeQuantityResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1553,12 +1503,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1617,10 +1561,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1768,7 +1708,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1883,7 +1822,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2110,12 +2048,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2237,7 +2169,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2279,10 +2210,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2536,12 +2463,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2663,7 +2584,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2705,10 +2625,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2796,13 +2712,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUpdateFixedFeeQuantityResponse.AdjustmentInterval - .Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2922,12 +2831,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval - .AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2977,10 +2880,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3130,7 +3029,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3250,7 +3148,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3482,12 +3379,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3613,7 +3504,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3657,11 +3547,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3927,12 +3812,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4058,7 +3937,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4102,11 +3980,6 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt index 1794498bd..b4bbc2495 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt @@ -25,12 +25,6 @@ internal class SubscriptionUpdateTrialResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -148,11 +142,6 @@ internal class SubscriptionUpdateTrialResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUpdateTrialResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -202,10 +191,6 @@ internal class SubscriptionUpdateTrialResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -355,7 +340,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -474,7 +458,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -706,12 +689,6 @@ internal class SubscriptionUpdateTrialResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -837,7 +814,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -881,11 +857,6 @@ internal class SubscriptionUpdateTrialResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1151,12 +1122,6 @@ internal class SubscriptionUpdateTrialResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1282,7 +1247,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1326,11 +1290,6 @@ internal class SubscriptionUpdateTrialResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -1416,12 +1375,6 @@ internal class SubscriptionUpdateTrialResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1546,11 +1499,6 @@ internal class SubscriptionUpdateTrialResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUpdateTrialResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1607,10 +1555,6 @@ internal class SubscriptionUpdateTrialResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1758,7 +1702,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1872,7 +1815,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2099,12 +2041,6 @@ internal class SubscriptionUpdateTrialResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2226,7 +2162,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2268,10 +2203,6 @@ internal class SubscriptionUpdateTrialResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2525,12 +2456,6 @@ internal class SubscriptionUpdateTrialResponseTest { Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2652,7 +2577,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -2694,10 +2618,6 @@ internal class SubscriptionUpdateTrialResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -2785,12 +2705,6 @@ internal class SubscriptionUpdateTrialResponseTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -2908,11 +2822,6 @@ internal class SubscriptionUpdateTrialResponseTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - SubscriptionUpdateTrialResponse.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -2962,10 +2871,6 @@ internal class SubscriptionUpdateTrialResponseTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -3115,7 +3020,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3234,7 +3138,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3466,12 +3369,6 @@ internal class SubscriptionUpdateTrialResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3597,7 +3494,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -3641,11 +3537,6 @@ internal class SubscriptionUpdateTrialResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") @@ -3911,12 +3802,6 @@ internal class SubscriptionUpdateTrialResponseTest { .MonetaryUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .amount("amount") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -4042,7 +3927,6 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -4086,11 +3970,6 @@ internal class SubscriptionUpdateTrialResponseTest { ) .name("Tier One") .quantity(5.0) - .type( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Type - .MATRIX - ) .build() ) .subtotal("9.00") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt index f638ba373..4958d5a2d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt @@ -27,12 +27,6 @@ internal class SubscriptionsTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -154,11 +148,6 @@ internal class SubscriptionsTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - Subscription.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -206,11 +195,6 @@ internal class SubscriptionsTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -376,7 +360,6 @@ internal class SubscriptionsTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -512,7 +495,6 @@ internal class SubscriptionsTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -569,12 +551,6 @@ internal class SubscriptionsTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -692,10 +668,6 @@ internal class SubscriptionsTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - Subscription.DiscountInterval.AmountDiscountInterval.DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -743,11 +715,6 @@ internal class SubscriptionsTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -905,7 +872,6 @@ internal class SubscriptionsTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1029,7 +995,6 @@ internal class SubscriptionsTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1087,12 +1052,6 @@ internal class SubscriptionsTest { .PlanPhaseUsageDiscountAdjustment .builder() .id("id") - .adjustmentType( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1214,11 +1173,6 @@ internal class SubscriptionsTest { .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") - .discountType( - Subscription.DiscountInterval.AmountDiscountInterval - .DiscountType - .AMOUNT - ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1266,11 +1220,6 @@ internal class SubscriptionsTest { .addAdjustment( Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() .id("id") - .adjustmentType( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment - .AdjustmentType - .USAGE_DISCOUNT - ) .addAppliesToPriceId("string") .isInvoiceLevel(true) .planPhaseOrder(0L) @@ -1436,7 +1385,6 @@ internal class SubscriptionsTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) @@ -1572,7 +1520,6 @@ internal class SubscriptionsTest { .build() ) .minimumAmount("minimum_amount") - .modelType(Price.UnitPrice.ModelType.UNIT) .name("name") .planPhaseOrder(0L) .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt index a928e8cfd..24be6c7da 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt @@ -134,11 +134,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -235,11 +230,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -336,11 +326,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -437,11 +422,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -538,11 +518,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -639,11 +614,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -740,11 +710,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -841,11 +806,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -940,11 +900,6 @@ internal class ErrorHandlingTest { CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt index 945c467d2..dece7ff5d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt @@ -100,11 +100,6 @@ internal class ServiceParamsTest { .taxConfiguration( CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt index e7518ed40..4581627d2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt @@ -89,11 +89,6 @@ internal class CustomerServiceAsyncTest { .taxConfiguration( CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -183,11 +178,6 @@ internal class CustomerServiceAsyncTest { .taxConfiguration( CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -388,12 +378,6 @@ internal class CustomerServiceAsyncTest { CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration - .NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt index 5236adb8f..762e41da4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt @@ -32,7 +32,6 @@ internal class PlanServiceAsyncTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt index db3179f89..4916bcea1 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt @@ -33,7 +33,6 @@ internal class PriceServiceAsyncTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt index 10923b97a..c24a19b46 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt @@ -47,12 +47,6 @@ internal class SubscriptionServiceAsyncTest { SubscriptionCreateParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -103,12 +97,6 @@ internal class SubscriptionServiceAsyncTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.AddPrice.Price @@ -219,12 +207,6 @@ internal class SubscriptionServiceAsyncTest { SubscriptionCreateParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -274,12 +256,6 @@ internal class SubscriptionServiceAsyncTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.ReplacePrice.Price @@ -560,12 +536,6 @@ internal class SubscriptionServiceAsyncTest { ) .currency("currency") .itemId("item_id") - .modelType( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionPriceIntervalsParams.Add.Price @@ -631,12 +601,6 @@ internal class SubscriptionServiceAsyncTest { SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -699,13 +663,6 @@ internal class SubscriptionServiceAsyncTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.AddAdjustment - .Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -761,12 +718,6 @@ internal class SubscriptionServiceAsyncTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.AddPrice.Price @@ -871,13 +822,6 @@ internal class SubscriptionServiceAsyncTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.ReplaceAdjustment - .Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -931,12 +875,6 @@ internal class SubscriptionServiceAsyncTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt index 783039188..61e61c4b5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt @@ -52,12 +52,6 @@ internal class LedgerServiceAsyncTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -109,12 +103,6 @@ internal class LedgerServiceAsyncTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt index c5744a007..51798b96b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt @@ -89,11 +89,6 @@ internal class CustomerServiceTest { .taxConfiguration( CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -182,11 +177,6 @@ internal class CustomerServiceTest { .taxConfiguration( CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() .taxExempt(true) - .taxProvider( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) @@ -368,12 +358,6 @@ internal class CustomerServiceTest { CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration .builder() .taxExempt(true) - .taxProvider( - CustomerUpdateByExternalIdParams.TaxConfiguration - .NewAvalaraTaxConfiguration - .TaxProvider - .AVALARA - ) .taxExemptionCode("tax_exemption_code") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt index 7dbc47d51..5e713d879 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt @@ -32,7 +32,6 @@ internal class PlanServiceTest { PlanCreateParams.Price.NewPlanUnitPrice.builder() .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) .itemId("item_id") - .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt index e38bd2759..2951de27e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt @@ -33,7 +33,6 @@ internal class PriceServiceTest { .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt index cccf8e7eb..351ee83c7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt @@ -47,12 +47,6 @@ internal class SubscriptionServiceTest { SubscriptionCreateParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -103,12 +97,6 @@ internal class SubscriptionServiceTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.AddPrice.Price @@ -219,12 +207,6 @@ internal class SubscriptionServiceTest { SubscriptionCreateParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -274,12 +256,6 @@ internal class SubscriptionServiceTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionCreateParams.ReplacePrice.Price @@ -552,12 +528,6 @@ internal class SubscriptionServiceTest { ) .currency("currency") .itemId("item_id") - .modelType( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionPriceIntervalsParams.Add.Price @@ -623,12 +593,6 @@ internal class SubscriptionServiceTest { SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -690,13 +654,6 @@ internal class SubscriptionServiceTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.AddAdjustment - .Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -752,12 +709,6 @@ internal class SubscriptionServiceTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.AddPrice.Price @@ -862,13 +813,6 @@ internal class SubscriptionServiceTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment .NewPercentageDiscount .builder() - .adjustmentType( - SubscriptionSchedulePlanChangeParams.ReplaceAdjustment - .Adjustment - .NewPercentageDiscount - .AdjustmentType - .PERCENTAGE_DISCOUNT - ) .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") .percentageDiscount(0.0) @@ -922,12 +866,6 @@ internal class SubscriptionServiceTest { .ANNUAL ) .itemId("item_id") - .modelType( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .ModelType - .UNIT - ) .name("Annual fee") .unitConfig( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt index 3befebde5..4b39618a1 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt @@ -51,12 +51,6 @@ internal class LedgerServiceTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -107,12 +101,6 @@ internal class LedgerServiceTest { .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) - .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .EntryType - .INCREMENT - ) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) From 7ddd872ee4fb49e2e3f4b6d5938bc9a5ed0e2342 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 22:18:09 +0000 Subject: [PATCH 12/18] feat(client): allow providing some params positionally --- .../main/kotlin/com/withorb/api/core/Check.kt | 3 + .../models/AlertCreateForCustomerParams.kt | 15 +- .../AlertCreateForExternalCustomerParams.kt | 18 +- .../AlertCreateForSubscriptionParams.kt | 16 +- .../withorb/api/models/AlertDisableParams.kt | 36 +- .../withorb/api/models/AlertEnableParams.kt | 36 +- .../withorb/api/models/AlertRetrieveParams.kt | 38 +- .../withorb/api/models/AlertUpdateParams.kt | 20 +- .../withorb/api/models/CouponArchiveParams.kt | 33 +- .../withorb/api/models/CouponFetchParams.kt | 38 +- .../models/CouponSubscriptionListParams.kt | 28 +- .../api/models/CreditNoteFetchParams.kt | 34 +- .../CustomerBalanceTransactionCreateParams.kt | 15 +- .../CustomerBalanceTransactionListParams.kt | 28 +- .../CustomerCostListByExternalIdParams.kt | 31 +- .../api/models/CustomerCostListParams.kt | 32 +- ...editLedgerCreateEntryByExternalIdParams.kt | 18 +- .../CustomerCreditLedgerCreateEntryParams.kt | 15 +- ...tomerCreditLedgerListByExternalIdParams.kt | 31 +- .../models/CustomerCreditLedgerListParams.kt | 28 +- .../CustomerCreditListByExternalIdParams.kt | 31 +- .../api/models/CustomerCreditListParams.kt | 32 +- ...omerCreditTopUpCreateByExternalIdParams.kt | 18 +- .../models/CustomerCreditTopUpCreateParams.kt | 15 +- ...omerCreditTopUpDeleteByExternalIdParams.kt | 16 +- .../models/CustomerCreditTopUpDeleteParams.kt | 16 +- ...stomerCreditTopUpListByExternalIdParams.kt | 31 +- .../models/CustomerCreditTopUpListParams.kt | 28 +- .../api/models/CustomerDeleteParams.kt | 33 +- .../models/CustomerFetchByExternalIdParams.kt | 33 +- .../withorb/api/models/CustomerFetchParams.kt | 34 +- ...dsFromGatewayByExternalCustomerIdParams.kt | 34 +- ...omerSyncPaymentMethodsFromGatewayParams.kt | 29 +- .../CustomerUpdateByExternalIdParams.kt | 27 +- .../api/models/CustomerUpdateParams.kt | 31 +- ...alDimensionalPriceGroupIdRetrieveParams.kt | 37 +- .../DimensionalPriceGroupRetrieveParams.kt | 34 +- .../api/models/EventBackfillCloseParams.kt | 33 +- .../api/models/EventBackfillFetchParams.kt | 34 +- .../api/models/EventBackfillRevertParams.kt | 29 +- .../api/models/EventDeprecateParams.kt | 33 +- .../withorb/api/models/EventUpdateParams.kt | 15 +- .../withorb/api/models/InvoiceFetchParams.kt | 38 +- .../withorb/api/models/InvoiceIssueParams.kt | 33 +- .../api/models/InvoiceMarkPaidParams.kt | 15 +- .../withorb/api/models/InvoicePayParams.kt | 33 +- .../withorb/api/models/InvoiceUpdateParams.kt | 32 +- .../api/models/InvoiceVoidInvoiceParams.kt | 33 +- .../com/withorb/api/models/ItemFetchParams.kt | 38 +- .../withorb/api/models/ItemUpdateParams.kt | 31 +- .../withorb/api/models/MetricFetchParams.kt | 38 +- .../withorb/api/models/MetricUpdateParams.kt | 32 +- .../models/PlanExternalPlanIdFetchParams.kt | 31 +- .../models/PlanExternalPlanIdUpdateParams.kt | 31 +- .../com/withorb/api/models/PlanFetchParams.kt | 38 +- .../withorb/api/models/PlanUpdateParams.kt | 32 +- .../withorb/api/models/PriceEvaluateParams.kt | 15 +- .../models/PriceExternalPriceIdFetchParams.kt | 31 +- .../PriceExternalPriceIdUpdateParams.kt | 29 +- .../withorb/api/models/PriceFetchParams.kt | 38 +- .../withorb/api/models/PriceUpdateParams.kt | 32 +- .../api/models/SubscriptionCancelParams.kt | 16 +- .../models/SubscriptionChangeApplyParams.kt | 32 +- .../models/SubscriptionChangeCancelParams.kt | 33 +- .../SubscriptionChangeRetrieveParams.kt | 34 +- .../models/SubscriptionFetchCostsParams.kt | 29 +- .../api/models/SubscriptionFetchParams.kt | 35 +- .../models/SubscriptionFetchScheduleParams.kt | 29 +- .../models/SubscriptionFetchUsageParams.kt | 29 +- .../SubscriptionPriceIntervalsParams.kt | 28 +- .../SubscriptionSchedulePlanChangeParams.kt | 16 +- .../models/SubscriptionTriggerPhaseParams.kt | 29 +- ...ubscriptionUnscheduleCancellationParams.kt | 30 +- ...UnscheduleFixedFeeQuantityUpdatesParams.kt | 18 +- ...ptionUnschedulePendingPlanChangesParams.kt | 30 +- ...ubscriptionUpdateFixedFeeQuantityParams.kt | 16 +- .../api/models/SubscriptionUpdateParams.kt | 33 +- .../models/SubscriptionUpdateTrialParams.kt | 16 +- .../api/services/async/AlertServiceAsync.kt | 340 +++++++- .../services/async/AlertServiceAsyncImpl.kt | 23 + .../api/services/async/CouponServiceAsync.kt | 120 ++- .../services/async/CouponServiceAsyncImpl.kt | 8 + .../services/async/CreditNoteServiceAsync.kt | 60 +- .../async/CreditNoteServiceAsyncImpl.kt | 5 + .../services/async/CustomerServiceAsync.kt | 510 ++++++++++- .../async/CustomerServiceAsyncImpl.kt | 23 + .../DimensionalPriceGroupServiceAsync.kt | 81 +- .../DimensionalPriceGroupServiceAsyncImpl.kt | 5 + .../api/services/async/EventServiceAsync.kt | 92 +- .../services/async/EventServiceAsyncImpl.kt | 8 + .../api/services/async/InvoiceServiceAsync.kt | 328 ++++++- .../services/async/InvoiceServiceAsyncImpl.kt | 20 + .../api/services/async/ItemServiceAsync.kt | 114 ++- .../services/async/ItemServiceAsyncImpl.kt | 8 + .../api/services/async/MetricServiceAsync.kt | 123 ++- .../services/async/MetricServiceAsyncImpl.kt | 8 + .../api/services/async/PlanServiceAsync.kt | 114 ++- .../services/async/PlanServiceAsyncImpl.kt | 8 + .../api/services/async/PriceServiceAsync.kt | 148 +++- .../services/async/PriceServiceAsyncImpl.kt | 11 + .../async/SubscriptionChangeServiceAsync.kt | 215 ++++- .../SubscriptionChangeServiceAsyncImpl.kt | 11 + .../async/SubscriptionServiceAsync.kt | 822 +++++++++++++++++- .../async/SubscriptionServiceAsyncImpl.kt | 44 + .../async/coupons/SubscriptionServiceAsync.kt | 66 +- .../coupons/SubscriptionServiceAsyncImpl.kt | 5 + .../BalanceTransactionServiceAsync.kt | 100 ++- .../BalanceTransactionServiceAsyncImpl.kt | 8 + .../async/customers/CostServiceAsync.kt | 145 ++- .../async/customers/CostServiceAsyncImpl.kt | 8 + .../async/customers/CreditServiceAsync.kt | 150 +++- .../async/customers/CreditServiceAsyncImpl.kt | 8 + .../customers/credits/LedgerServiceAsync.kt | 222 ++++- .../credits/LedgerServiceAsyncImpl.kt | 14 + .../customers/credits/TopUpServiceAsync.kt | 281 +++++- .../credits/TopUpServiceAsyncImpl.kt | 20 + ...rnalDimensionalPriceGroupIdServiceAsync.kt | 98 ++- ...DimensionalPriceGroupIdServiceAsyncImpl.kt | 8 + .../async/events/BackfillServiceAsync.kt | 198 ++++- .../async/events/BackfillServiceAsyncImpl.kt | 11 + .../async/plans/ExternalPlanIdServiceAsync.kt | 126 ++- .../plans/ExternalPlanIdServiceAsyncImpl.kt | 8 + .../prices/ExternalPriceIdServiceAsync.kt | 120 ++- .../prices/ExternalPriceIdServiceAsyncImpl.kt | 8 + .../api/services/blocking/AlertService.kt | 311 ++++++- .../api/services/blocking/AlertServiceImpl.kt | 23 + .../api/services/blocking/CouponService.kt | 102 ++- .../services/blocking/CouponServiceImpl.kt | 8 + .../services/blocking/CreditNoteService.kt | 55 +- .../blocking/CreditNoteServiceImpl.kt | 5 + .../api/services/blocking/CustomerService.kt | 466 +++++++++- .../services/blocking/CustomerServiceImpl.kt | 23 + .../blocking/DimensionalPriceGroupService.kt | 78 +- .../DimensionalPriceGroupServiceImpl.kt | 5 + .../api/services/blocking/EventService.kt | 87 +- .../api/services/blocking/EventServiceImpl.kt | 8 + .../api/services/blocking/InvoiceService.kt | 285 +++++- .../services/blocking/InvoiceServiceImpl.kt | 20 + .../api/services/blocking/ItemService.kt | 96 +- .../api/services/blocking/ItemServiceImpl.kt | 8 + .../api/services/blocking/MetricService.kt | 110 ++- .../services/blocking/MetricServiceImpl.kt | 8 + .../api/services/blocking/PlanService.kt | 96 +- .../api/services/blocking/PlanServiceImpl.kt | 8 + .../api/services/blocking/PriceService.kt | 126 ++- .../api/services/blocking/PriceServiceImpl.kt | 11 + .../blocking/SubscriptionChangeService.kt | 210 ++++- .../blocking/SubscriptionChangeServiceImpl.kt | 11 + .../services/blocking/SubscriptionService.kt | 789 ++++++++++++++++- .../blocking/SubscriptionServiceImpl.kt | 44 + .../blocking/coupons/SubscriptionService.kt | 60 +- .../coupons/SubscriptionServiceImpl.kt | 5 + .../customers/BalanceTransactionService.kt | 96 +- .../BalanceTransactionServiceImpl.kt | 8 + .../blocking/customers/CostService.kt | 140 ++- .../blocking/customers/CostServiceImpl.kt | 8 + .../blocking/customers/CreditService.kt | 141 ++- .../blocking/customers/CreditServiceImpl.kt | 8 + .../customers/credits/LedgerService.kt | 214 ++++- .../customers/credits/LedgerServiceImpl.kt | 14 + .../customers/credits/TopUpService.kt | 264 +++++- .../customers/credits/TopUpServiceImpl.kt | 20 + .../ExternalDimensionalPriceGroupIdService.kt | 96 +- ...ernalDimensionalPriceGroupIdServiceImpl.kt | 8 + .../blocking/events/BackfillService.kt | 180 +++- .../blocking/events/BackfillServiceImpl.kt | 11 + .../blocking/plans/ExternalPlanIdService.kt | 113 ++- .../plans/ExternalPlanIdServiceImpl.kt | 8 + .../blocking/prices/ExternalPriceIdService.kt | 111 ++- .../prices/ExternalPriceIdServiceImpl.kt | 8 + .../services/async/AlertServiceAsyncTest.kt | 4 +- .../services/async/CouponServiceAsyncTest.kt | 8 +- .../async/CreditNoteServiceAsyncTest.kt | 6 +- .../async/CustomerServiceAsyncTest.kt | 33 +- .../DimensionalPriceGroupServiceAsyncTest.kt | 7 +- .../services/async/EventServiceAsyncTest.kt | 4 +- .../services/async/InvoiceServiceAsyncTest.kt | 14 +- .../services/async/ItemServiceAsyncTest.kt | 3 +- .../services/async/MetricServiceAsyncTest.kt | 4 +- .../services/async/PlanServiceAsyncTest.kt | 3 +- .../services/async/PriceServiceAsyncTest.kt | 4 +- .../SubscriptionChangeServiceAsyncTest.kt | 15 +- .../async/SubscriptionServiceAsyncTest.kt | 27 +- .../coupons/SubscriptionServiceAsyncTest.kt | 6 +- .../BalanceTransactionServiceAsyncTest.kt | 6 +- .../async/customers/CreditServiceAsyncTest.kt | 14 +- .../credits/LedgerServiceAsyncTest.kt | 14 +- .../credits/TopUpServiceAsyncTest.kt | 14 +- ...DimensionalPriceGroupIdServiceAsyncTest.kt | 5 +- .../async/events/BackfillServiceAsyncTest.kt | 18 +- .../plans/ExternalPlanIdServiceAsyncTest.kt | 6 +- .../prices/ExternalPriceIdServiceAsyncTest.kt | 8 +- .../api/services/blocking/AlertServiceTest.kt | 3 +- .../services/blocking/CouponServiceTest.kt | 7 +- .../blocking/CreditNoteServiceTest.kt | 6 +- .../services/blocking/CustomerServiceTest.kt | 27 +- .../DimensionalPriceGroupServiceTest.kt | 7 +- .../api/services/blocking/EventServiceTest.kt | 4 +- .../services/blocking/InvoiceServiceTest.kt | 13 +- .../api/services/blocking/ItemServiceTest.kt | 3 +- .../services/blocking/MetricServiceTest.kt | 4 +- .../api/services/blocking/PlanServiceTest.kt | 3 +- .../api/services/blocking/PriceServiceTest.kt | 3 +- .../blocking/SubscriptionChangeServiceTest.kt | 16 +- .../blocking/SubscriptionServiceTest.kt | 28 +- .../coupons/SubscriptionServiceTest.kt | 6 +- .../BalanceTransactionServiceTest.kt | 6 +- .../blocking/customers/CreditServiceTest.kt | 12 +- .../customers/credits/LedgerServiceTest.kt | 14 +- .../customers/credits/TopUpServiceTest.kt | 14 +- ...ernalDimensionalPriceGroupIdServiceTest.kt | 7 +- .../blocking/events/BackfillServiceTest.kt | 18 +- .../plans/ExternalPlanIdServiceTest.kt | 6 +- .../prices/ExternalPriceIdServiceTest.kt | 8 +- 214 files changed, 9897 insertions(+), 2089 deletions(-) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt index 5187003e3..a88b2cbb9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt @@ -5,6 +5,9 @@ package com.withorb.api.core import com.fasterxml.jackson.core.Version import com.fasterxml.jackson.core.util.VersionUtil +fun checkRequired(name: String, condition: Boolean) = + check(condition) { "`$name` is required, but was not set" } + fun checkRequired(name: String, value: T?): T = checkNotNull(value) { "`$name` is required, but was not set" } 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 c05cc2801..7e5df1711 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 @@ -33,13 +33,13 @@ import kotlin.jvm.optionals.getOrNull */ class AlertCreateForCustomerParams private constructor( - private val customerId: String, + private val customerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** * The case sensitive currency or custom pricing unit to use for this alert. @@ -101,7 +101,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .currency() * .type() * ``` @@ -125,7 +124,10 @@ private constructor( additionalQueryParams = alertCreateForCustomerParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * Sets the entire request body. @@ -308,7 +310,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .currency() * .type() * ``` @@ -317,7 +318,7 @@ private constructor( */ fun build(): AlertCreateForCustomerParams = AlertCreateForCustomerParams( - checkRequired("customerId", customerId), + customerId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -328,7 +329,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 73df3de41..d1787b4e3 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 @@ -33,13 +33,13 @@ import kotlin.jvm.optionals.getOrNull */ class AlertCreateForExternalCustomerParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) /** * The case sensitive currency or custom pricing unit to use for this alert. @@ -102,7 +102,6 @@ private constructor( * * The following fields are required: * ```java - * .externalCustomerId() * .currency() * .type() * ``` @@ -129,10 +128,16 @@ private constructor( alertCreateForExternalCustomerParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + /** * Sets the entire request body. * @@ -314,7 +319,6 @@ private constructor( * * The following fields are required: * ```java - * .externalCustomerId() * .currency() * .type() * ``` @@ -323,7 +327,7 @@ private constructor( */ fun build(): AlertCreateForExternalCustomerParams = AlertCreateForExternalCustomerParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -334,7 +338,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 00d15efb8..6cc5c393e 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 @@ -37,13 +37,13 @@ import kotlin.jvm.optionals.getOrNull */ class AlertCreateForSubscriptionParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * The thresholds that define the values at which the alert will be triggered. @@ -106,7 +106,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .thresholds() * .type() * ``` @@ -132,7 +131,11 @@ private constructor( alertCreateForSubscriptionParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -315,7 +318,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .thresholds() * .type() * ``` @@ -324,7 +326,7 @@ private constructor( */ fun build(): AlertCreateForSubscriptionParams = AlertCreateForSubscriptionParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -335,7 +337,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 f0fb5a14c..0e1f15a1f 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 @@ -4,7 +4,6 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -19,14 +18,14 @@ import kotlin.jvm.optionals.getOrNull */ class AlertDisableParams private constructor( - private val alertConfigurationId: String, + private val alertConfigurationId: String?, private val subscriptionId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun alertConfigurationId(): String = alertConfigurationId + fun alertConfigurationId(): Optional = Optional.ofNullable(alertConfigurationId) /** Used to update the status of a plan alert scoped to this subscription_id */ fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) @@ -41,14 +40,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [AlertDisableParams]. - * - * The following fields are required: - * ```java - * .alertConfigurationId() - * ``` - */ + @JvmStatic fun none(): AlertDisableParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [AlertDisableParams]. */ @JvmStatic fun builder() = Builder() } @@ -70,10 +64,17 @@ private constructor( additionalBodyProperties = alertDisableParams.additionalBodyProperties.toMutableMap() } - fun alertConfigurationId(alertConfigurationId: String) = apply { + fun alertConfigurationId(alertConfigurationId: String?) = apply { this.alertConfigurationId = alertConfigurationId } + /** + * Alias for calling [Builder.alertConfigurationId] with + * `alertConfigurationId.orElse(null)`. + */ + fun alertConfigurationId(alertConfigurationId: Optional) = + alertConfigurationId(alertConfigurationId.getOrNull()) + /** Used to update the status of a plan alert scoped to this subscription_id */ fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } @@ -205,17 +206,10 @@ private constructor( * Returns an immutable instance of [AlertDisableParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .alertConfigurationId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): AlertDisableParams = AlertDisableParams( - checkRequired("alertConfigurationId", alertConfigurationId), + alertConfigurationId, subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), @@ -228,7 +222,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> alertConfigurationId + 0 -> alertConfigurationId ?: "" else -> "" } 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 beb1c38cd..726e00d06 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 @@ -4,7 +4,6 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -19,14 +18,14 @@ import kotlin.jvm.optionals.getOrNull */ class AlertEnableParams private constructor( - private val alertConfigurationId: String, + private val alertConfigurationId: String?, private val subscriptionId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun alertConfigurationId(): String = alertConfigurationId + fun alertConfigurationId(): Optional = Optional.ofNullable(alertConfigurationId) /** Used to update the status of a plan alert scoped to this subscription_id */ fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) @@ -41,14 +40,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [AlertEnableParams]. - * - * The following fields are required: - * ```java - * .alertConfigurationId() - * ``` - */ + @JvmStatic fun none(): AlertEnableParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [AlertEnableParams]. */ @JvmStatic fun builder() = Builder() } @@ -70,10 +64,17 @@ private constructor( additionalBodyProperties = alertEnableParams.additionalBodyProperties.toMutableMap() } - fun alertConfigurationId(alertConfigurationId: String) = apply { + fun alertConfigurationId(alertConfigurationId: String?) = apply { this.alertConfigurationId = alertConfigurationId } + /** + * Alias for calling [Builder.alertConfigurationId] with + * `alertConfigurationId.orElse(null)`. + */ + fun alertConfigurationId(alertConfigurationId: Optional) = + alertConfigurationId(alertConfigurationId.getOrNull()) + /** Used to update the status of a plan alert scoped to this subscription_id */ fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } @@ -205,17 +206,10 @@ private constructor( * Returns an immutable instance of [AlertEnableParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .alertConfigurationId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): AlertEnableParams = AlertEnableParams( - checkRequired("alertConfigurationId", alertConfigurationId), + alertConfigurationId, subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), @@ -228,7 +222,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> alertConfigurationId + 0 -> alertConfigurationId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt index 0f01a4098..1f7801524 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt @@ -3,20 +3,21 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** This endpoint retrieves an alert by its ID. */ class AlertRetrieveParams private constructor( - private val alertId: String, + private val alertId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun alertId(): String = alertId + fun alertId(): Optional = Optional.ofNullable(alertId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +27,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [AlertRetrieveParams]. - * - * The following fields are required: - * ```java - * .alertId() - * ``` - */ + @JvmStatic fun none(): AlertRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [AlertRetrieveParams]. */ @JvmStatic fun builder() = Builder() } @@ -51,7 +47,10 @@ private constructor( additionalQueryParams = alertRetrieveParams.additionalQueryParams.toBuilder() } - fun alertId(alertId: String) = apply { this.alertId = alertId } + fun alertId(alertId: String?) = apply { this.alertId = alertId } + + /** Alias for calling [Builder.alertId] with `alertId.orElse(null)`. */ + fun alertId(alertId: Optional) = alertId(alertId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -155,25 +154,14 @@ private constructor( * Returns an immutable instance of [AlertRetrieveParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .alertId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): AlertRetrieveParams = - AlertRetrieveParams( - checkRequired("alertId", alertId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + AlertRetrieveParams(alertId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> alertId + 0 -> alertId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt index f61a35f6c..6dda2bc8e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt @@ -19,18 +19,19 @@ import com.withorb.api.core.toImmutable import com.withorb.api.errors.OrbInvalidDataException import java.util.Collections import java.util.Objects +import java.util.Optional import kotlin.jvm.optionals.getOrNull /** This endpoint updates the thresholds of an alert. */ class AlertUpdateParams private constructor( - private val alertConfigurationId: String, + private val alertConfigurationId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun alertConfigurationId(): String = alertConfigurationId + fun alertConfigurationId(): Optional = Optional.ofNullable(alertConfigurationId) /** * The thresholds that define the values at which the alert will be triggered. @@ -62,7 +63,6 @@ private constructor( * * The following fields are required: * ```java - * .alertConfigurationId() * .thresholds() * ``` */ @@ -85,10 +85,17 @@ private constructor( additionalQueryParams = alertUpdateParams.additionalQueryParams.toBuilder() } - fun alertConfigurationId(alertConfigurationId: String) = apply { + fun alertConfigurationId(alertConfigurationId: String?) = apply { this.alertConfigurationId = alertConfigurationId } + /** + * Alias for calling [Builder.alertConfigurationId] with + * `alertConfigurationId.orElse(null)`. + */ + fun alertConfigurationId(alertConfigurationId: Optional) = + alertConfigurationId(alertConfigurationId.getOrNull()) + /** * Sets the entire request body. * @@ -243,7 +250,6 @@ private constructor( * * The following fields are required: * ```java - * .alertConfigurationId() * .thresholds() * ``` * @@ -251,7 +257,7 @@ private constructor( */ fun build(): AlertUpdateParams = AlertUpdateParams( - checkRequired("alertConfigurationId", alertConfigurationId), + alertConfigurationId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -262,7 +268,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> alertConfigurationId + 0 -> alertConfigurationId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt index c1dfe5f36..f8cff3dc5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint allows a coupon to be archived. Archived coupons can no longer be redeemed, and @@ -18,13 +18,13 @@ import java.util.Optional */ class CouponArchiveParams private constructor( - private val couponId: String, + private val couponId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun couponId(): String = couponId + fun couponId(): Optional = Optional.ofNullable(couponId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -36,14 +36,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CouponArchiveParams]. - * - * The following fields are required: - * ```java - * .couponId() - * ``` - */ + @JvmStatic fun none(): CouponArchiveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CouponArchiveParams]. */ @JvmStatic fun builder() = Builder() } @@ -63,7 +58,10 @@ private constructor( additionalBodyProperties = couponArchiveParams.additionalBodyProperties.toMutableMap() } - fun couponId(couponId: String) = apply { this.couponId = couponId } + fun couponId(couponId: String?) = apply { this.couponId = couponId } + + /** Alias for calling [Builder.couponId] with `couponId.orElse(null)`. */ + fun couponId(couponId: Optional) = couponId(couponId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -189,17 +187,10 @@ private constructor( * Returns an immutable instance of [CouponArchiveParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .couponId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CouponArchiveParams = CouponArchiveParams( - checkRequired("couponId", couponId), + couponId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -211,7 +202,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> couponId + 0 -> couponId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt index afb3aebcd..9222e419e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption code, use the @@ -14,12 +15,12 @@ import java.util.Objects */ class CouponFetchParams private constructor( - private val couponId: String, + private val couponId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun couponId(): String = couponId + fun couponId(): Optional = Optional.ofNullable(couponId) fun _additionalHeaders(): Headers = additionalHeaders @@ -29,14 +30,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CouponFetchParams]. - * - * The following fields are required: - * ```java - * .couponId() - * ``` - */ + @JvmStatic fun none(): CouponFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CouponFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -54,7 +50,10 @@ private constructor( additionalQueryParams = couponFetchParams.additionalQueryParams.toBuilder() } - fun couponId(couponId: String) = apply { this.couponId = couponId } + fun couponId(couponId: String?) = apply { this.couponId = couponId } + + /** Alias for calling [Builder.couponId] with `couponId.orElse(null)`. */ + fun couponId(couponId: Optional) = couponId(couponId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -158,25 +157,14 @@ private constructor( * Returns an immutable instance of [CouponFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .couponId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CouponFetchParams = - CouponFetchParams( - checkRequired("couponId", couponId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + CouponFetchParams(couponId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> couponId + 0 -> couponId ?: "" else -> "" } 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 a3b3be8dd..6ed44a4fc 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects @@ -18,14 +17,14 @@ import kotlin.jvm.optionals.getOrNull */ class CouponSubscriptionListParams private constructor( - private val couponId: String, + private val couponId: String?, private val cursor: String?, private val limit: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun couponId(): String = couponId + fun couponId(): Optional = Optional.ofNullable(couponId) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -44,13 +43,10 @@ private constructor( companion object { + @JvmStatic fun none(): CouponSubscriptionListParams = builder().build() + /** * Returns a mutable builder for constructing an instance of [CouponSubscriptionListParams]. - * - * The following fields are required: - * ```java - * .couponId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -73,7 +69,10 @@ private constructor( additionalQueryParams = couponSubscriptionListParams.additionalQueryParams.toBuilder() } - fun couponId(couponId: String) = apply { this.couponId = couponId } + fun couponId(couponId: String?) = apply { this.couponId = couponId } + + /** Alias for calling [Builder.couponId] with `couponId.orElse(null)`. */ + fun couponId(couponId: Optional) = couponId(couponId.getOrNull()) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -199,17 +198,10 @@ private constructor( * Returns an immutable instance of [CouponSubscriptionListParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .couponId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CouponSubscriptionListParams = CouponSubscriptionListParams( - checkRequired("couponId", couponId), + couponId, cursor, limit, additionalHeaders.build(), @@ -219,7 +211,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> couponId + 0 -> couponId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt index 04c0d080d..827792b4e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to fetch a single [`Credit Note`](/invoicing/credit-notes) given an @@ -14,12 +15,12 @@ import java.util.Objects */ class CreditNoteFetchParams private constructor( - private val creditNoteId: String, + private val creditNoteId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun creditNoteId(): String = creditNoteId + fun creditNoteId(): Optional = Optional.ofNullable(creditNoteId) fun _additionalHeaders(): Headers = additionalHeaders @@ -29,14 +30,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CreditNoteFetchParams]. - * - * The following fields are required: - * ```java - * .creditNoteId() - * ``` - */ + @JvmStatic fun none(): CreditNoteFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CreditNoteFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -54,7 +50,10 @@ private constructor( additionalQueryParams = creditNoteFetchParams.additionalQueryParams.toBuilder() } - fun creditNoteId(creditNoteId: String) = apply { this.creditNoteId = creditNoteId } + fun creditNoteId(creditNoteId: String?) = apply { this.creditNoteId = creditNoteId } + + /** Alias for calling [Builder.creditNoteId] with `creditNoteId.orElse(null)`. */ + fun creditNoteId(creditNoteId: Optional) = creditNoteId(creditNoteId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -158,17 +157,10 @@ private constructor( * Returns an immutable instance of [CreditNoteFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .creditNoteId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CreditNoteFetchParams = CreditNoteFetchParams( - checkRequired("creditNoteId", creditNoteId), + creditNoteId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -176,7 +168,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> creditNoteId + 0 -> creditNoteId ?: "" else -> "" } 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 e26589262..31b73445e 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 @@ -27,13 +27,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerBalanceTransactionCreateParams private constructor( - private val customerId: String, + private val customerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly @@ -92,7 +92,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .amount() * .type() * ``` @@ -119,7 +118,10 @@ private constructor( customerBalanceTransactionCreateParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * Sets the entire request body. @@ -291,7 +293,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .amount() * .type() * ``` @@ -300,7 +301,7 @@ private constructor( */ fun build(): CustomerBalanceTransactionCreateParams = CustomerBalanceTransactionCreateParams( - checkRequired("customerId", customerId), + customerId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -311,7 +312,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 f1364f6a8..52a4bc00d 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.time.OffsetDateTime @@ -40,7 +39,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerBalanceTransactionListParams private constructor( - private val customerId: String, + private val customerId: String?, private val cursor: String?, private val limit: Long?, private val operationTimeGt: OffsetDateTime?, @@ -51,7 +50,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -78,14 +77,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerBalanceTransactionListParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerBalanceTransactionListParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -119,7 +115,10 @@ private constructor( customerBalanceTransactionListParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -277,17 +276,10 @@ private constructor( * Returns an immutable instance of [CustomerBalanceTransactionListParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerBalanceTransactionListParams = CustomerBalanceTransactionListParams( - checkRequired("customerId", customerId), + customerId, cursor, limit, operationTimeGt, @@ -301,7 +293,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 fd63e2d19..174a94c49 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 @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -126,7 +125,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCostListByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val currency: String?, private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, @@ -135,7 +134,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) /** The currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) @@ -161,14 +160,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerCostListByExternalIdParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerCostListByExternalIdParams]. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -197,10 +193,16 @@ private constructor( customerCostListByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + /** The currency or custom pricing unit to use. */ fun currency(currency: String?) = apply { this.currency = currency } @@ -335,17 +337,10 @@ private constructor( * Returns an immutable instance of [CustomerCostListByExternalIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, currency, timeframeEnd, timeframeStart, @@ -357,7 +352,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 75f29da0d..2fbc742a5 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 @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -126,7 +125,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCostListParams private constructor( - private val customerId: String, + private val customerId: String?, private val currency: String?, private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, @@ -135,7 +134,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** The currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) @@ -161,14 +160,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CustomerCostListParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - */ + @JvmStatic fun none(): CustomerCostListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CustomerCostListParams]. */ @JvmStatic fun builder() = Builder() } @@ -194,7 +188,10 @@ private constructor( additionalQueryParams = customerCostListParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** The currency or custom pricing unit to use. */ fun currency(currency: String?) = apply { this.currency = currency } @@ -330,17 +327,10 @@ private constructor( * Returns an immutable instance of [CustomerCostListParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCostListParams = CustomerCostListParams( - checkRequired("customerId", customerId), + customerId, currency, timeframeEnd, timeframeStart, @@ -352,7 +342,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 9b3b099ad..91f2d8e46 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 @@ -138,13 +138,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditLedgerCreateEntryByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) fun body(): Body = body @@ -162,7 +162,6 @@ private constructor( * * The following fields are required: * ```java - * .externalCustomerId() * .body() * ``` */ @@ -191,10 +190,16 @@ private constructor( customerCreditLedgerCreateEntryByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + fun body(body: Body) = apply { this.body = body } /** @@ -391,7 +396,6 @@ private constructor( * * The following fields are required: * ```java - * .externalCustomerId() * .body() * ``` * @@ -399,7 +403,7 @@ private constructor( */ fun build(): CustomerCreditLedgerCreateEntryByExternalIdParams = CustomerCreditLedgerCreateEntryByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, checkRequired("body", body), additionalHeaders.build(), additionalQueryParams.build(), @@ -410,7 +414,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 3e4bf0127..5c1d59aa4 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 @@ -138,13 +138,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditLedgerCreateEntryParams private constructor( - private val customerId: String, + private val customerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) fun body(): Body = body @@ -162,7 +162,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .body() * ``` */ @@ -188,7 +187,10 @@ private constructor( customerCreditLedgerCreateEntryParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) fun body(body: Body) = apply { this.body = body } @@ -386,7 +388,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .body() * ``` * @@ -394,7 +395,7 @@ private constructor( */ fun build(): CustomerCreditLedgerCreateEntryParams = CustomerCreditLedgerCreateEntryParams( - checkRequired("customerId", customerId), + customerId, checkRequired("body", body), additionalHeaders.build(), additionalQueryParams.build(), @@ -405,7 +406,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 2271ced0f..8dd1b841f 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 @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -95,7 +94,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditLedgerListByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val createdAtGt: OffsetDateTime?, private val createdAtGte: OffsetDateTime?, private val createdAtLt: OffsetDateTime?, @@ -110,7 +109,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -146,14 +145,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerCreditLedgerListByExternalIdParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerCreditLedgerListByExternalIdParams]. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -196,10 +192,16 @@ private constructor( customerCreditLedgerListByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + fun createdAtGt(createdAtGt: OffsetDateTime?) = apply { this.createdAtGt = createdAtGt } /** Alias for calling [Builder.createdAtGt] with `createdAtGt.orElse(null)`. */ @@ -370,17 +372,10 @@ private constructor( * Returns an immutable instance of [CustomerCreditLedgerListByExternalIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCreditLedgerListByExternalIdParams = CustomerCreditLedgerListByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, createdAtGt, createdAtGte, createdAtLt, @@ -398,7 +393,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 9d9efa691..61a6b3d14 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 @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -95,7 +94,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditLedgerListParams private constructor( - private val customerId: String, + private val customerId: String?, private val createdAtGt: OffsetDateTime?, private val createdAtGte: OffsetDateTime?, private val createdAtLt: OffsetDateTime?, @@ -110,7 +109,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -146,14 +145,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerCreditLedgerListParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerCreditLedgerListParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -192,7 +188,10 @@ private constructor( additionalQueryParams = customerCreditLedgerListParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) fun createdAtGt(createdAtGt: OffsetDateTime?) = apply { this.createdAtGt = createdAtGt } @@ -364,17 +363,10 @@ private constructor( * Returns an immutable instance of [CustomerCreditLedgerListParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCreditLedgerListParams = CustomerCreditLedgerListParams( - checkRequired("customerId", customerId), + customerId, createdAtGt, createdAtGte, createdAtLt, @@ -392,7 +384,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 a5ab67ad6..144e5b750 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects @@ -21,7 +20,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditListByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val currency: String?, private val cursor: String?, private val includeAllBlocks: Boolean?, @@ -30,7 +29,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) /** The ledger currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) @@ -57,14 +56,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerCreditListByExternalIdParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerCreditListByExternalIdParams]. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -94,10 +90,16 @@ private constructor( customerCreditListByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + /** The ledger currency or custom pricing unit to use. */ fun currency(currency: String?) = apply { this.currency = currency } @@ -248,17 +250,10 @@ private constructor( * Returns an immutable instance of [CustomerCreditListByExternalIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCreditListByExternalIdParams = CustomerCreditListByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, currency, cursor, includeAllBlocks, @@ -270,7 +265,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 210e227ba..54fbcf437 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects @@ -21,7 +20,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditListParams private constructor( - private val customerId: String, + private val customerId: String?, private val currency: String?, private val cursor: String?, private val includeAllBlocks: Boolean?, @@ -30,7 +29,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** The ledger currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) @@ -57,14 +56,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CustomerCreditListParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - */ + @JvmStatic fun none(): CustomerCreditListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CustomerCreditListParams]. */ @JvmStatic fun builder() = Builder() } @@ -90,7 +84,10 @@ private constructor( additionalQueryParams = customerCreditListParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** The ledger currency or custom pricing unit to use. */ fun currency(currency: String?) = apply { this.currency = currency } @@ -242,17 +239,10 @@ private constructor( * Returns an immutable instance of [CustomerCreditListParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCreditListParams = CustomerCreditListParams( - checkRequired("customerId", customerId), + customerId, currency, cursor, includeAllBlocks, @@ -264,7 +254,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 ace42fa8e..5e1a87085 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 @@ -32,13 +32,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditTopUpCreateByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) /** * The amount to increment when the threshold is reached. @@ -181,7 +181,6 @@ private constructor( * * The following fields are required: * ```java - * .externalCustomerId() * .amount() * .currency() * .invoiceSettings() @@ -212,10 +211,16 @@ private constructor( customerCreditTopUpCreateByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + /** * Sets the entire request body. * @@ -491,7 +496,6 @@ private constructor( * * The following fields are required: * ```java - * .externalCustomerId() * .amount() * .currency() * .invoiceSettings() @@ -503,7 +507,7 @@ private constructor( */ fun build(): CustomerCreditTopUpCreateByExternalIdParams = CustomerCreditTopUpCreateByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -514,7 +518,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 a564f8675..a813d1766 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 @@ -32,13 +32,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreditTopUpCreateParams private constructor( - private val customerId: String, + private val customerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** * The amount to increment when the threshold is reached. @@ -181,7 +181,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .amount() * .currency() * .invoiceSettings() @@ -210,7 +209,10 @@ private constructor( customerCreditTopUpCreateParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * Sets the entire request body. @@ -487,7 +489,6 @@ private constructor( * * The following fields are required: * ```java - * .customerId() * .amount() * .currency() * .invoiceSettings() @@ -499,7 +500,7 @@ private constructor( */ fun build(): CustomerCreditTopUpCreateParams = CustomerCreditTopUpCreateParams( - checkRequired("customerId", customerId), + customerId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -510,7 +511,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt index 3f7c71c85..308b299e9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt @@ -10,6 +10,7 @@ import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This deactivates the top-up and voids any invoices associated with pending credit blocks @@ -18,7 +19,7 @@ import java.util.Optional class CustomerCreditTopUpDeleteByExternalIdParams private constructor( private val externalCustomerId: String, - private val topUpId: String, + private val topUpId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, @@ -26,7 +27,7 @@ private constructor( fun externalCustomerId(): String = externalCustomerId - fun topUpId(): String = topUpId + fun topUpId(): Optional = Optional.ofNullable(topUpId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -45,7 +46,6 @@ private constructor( * The following fields are required: * ```java * .externalCustomerId() - * .topUpId() * ``` */ @JvmStatic fun builder() = Builder() @@ -78,7 +78,10 @@ private constructor( this.externalCustomerId = externalCustomerId } - fun topUpId(topUpId: String) = apply { this.topUpId = topUpId } + fun topUpId(topUpId: String?) = apply { this.topUpId = topUpId } + + /** Alias for calling [Builder.topUpId] with `topUpId.orElse(null)`. */ + fun topUpId(topUpId: Optional) = topUpId(topUpId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -208,7 +211,6 @@ private constructor( * The following fields are required: * ```java * .externalCustomerId() - * .topUpId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -216,7 +218,7 @@ private constructor( fun build(): CustomerCreditTopUpDeleteByExternalIdParams = CustomerCreditTopUpDeleteByExternalIdParams( checkRequired("externalCustomerId", externalCustomerId), - checkRequired("topUpId", topUpId), + topUpId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -229,7 +231,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { 0 -> externalCustomerId - 1 -> topUpId + 1 -> topUpId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt index 8ae900f6b..e6206cab1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt @@ -10,6 +10,7 @@ import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This deactivates the top-up and voids any invoices associated with pending credit blocks @@ -18,7 +19,7 @@ import java.util.Optional class CustomerCreditTopUpDeleteParams private constructor( private val customerId: String, - private val topUpId: String, + private val topUpId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, @@ -26,7 +27,7 @@ private constructor( fun customerId(): String = customerId - fun topUpId(): String = topUpId + fun topUpId(): Optional = Optional.ofNullable(topUpId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -45,7 +46,6 @@ private constructor( * The following fields are required: * ```java * .customerId() - * .topUpId() * ``` */ @JvmStatic fun builder() = Builder() @@ -74,7 +74,10 @@ private constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } - fun topUpId(topUpId: String) = apply { this.topUpId = topUpId } + fun topUpId(topUpId: String?) = apply { this.topUpId = topUpId } + + /** Alias for calling [Builder.topUpId] with `topUpId.orElse(null)`. */ + fun topUpId(topUpId: Optional) = topUpId(topUpId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -204,7 +207,6 @@ private constructor( * The following fields are required: * ```java * .customerId() - * .topUpId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -212,7 +214,7 @@ private constructor( fun build(): CustomerCreditTopUpDeleteParams = CustomerCreditTopUpDeleteParams( checkRequired("customerId", customerId), - checkRequired("topUpId", topUpId), + topUpId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -225,7 +227,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { 0 -> customerId - 1 -> topUpId + 1 -> topUpId ?: "" else -> "" } 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 fc764c55d..47a51cd15 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects @@ -13,14 +12,14 @@ import kotlin.jvm.optionals.getOrNull /** List top-ups by external ID */ class CustomerCreditTopUpListByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val cursor: String?, private val limit: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -39,14 +38,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerCreditTopUpListByExternalIdParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerCreditTopUpListByExternalIdParams]. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -73,10 +69,16 @@ private constructor( customerCreditTopUpListByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the * initial request. @@ -201,17 +203,10 @@ private constructor( * Returns an immutable instance of [CustomerCreditTopUpListByExternalIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCreditTopUpListByExternalIdParams = CustomerCreditTopUpListByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, cursor, limit, additionalHeaders.build(), @@ -221,7 +216,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } 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 f8c93c848..4ab5d0aae 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects @@ -13,14 +12,14 @@ import kotlin.jvm.optionals.getOrNull /** List top-ups */ class CustomerCreditTopUpListParams private constructor( - private val customerId: String, + private val customerId: String?, private val cursor: String?, private val limit: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -39,14 +38,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerCreditTopUpListParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerCreditTopUpListParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -69,7 +65,10 @@ private constructor( additionalQueryParams = customerCreditTopUpListParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -195,17 +194,10 @@ private constructor( * Returns an immutable instance of [CustomerCreditTopUpListParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerCreditTopUpListParams = CustomerCreditTopUpListParams( - checkRequired("customerId", customerId), + customerId, cursor, limit, additionalHeaders.build(), @@ -215,7 +207,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt index e409eece5..589a6cfcf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This performs a deletion of this customer, its subscriptions, and its invoices, provided the @@ -28,13 +28,13 @@ import java.util.Optional */ class CustomerDeleteParams private constructor( - private val customerId: String, + private val customerId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -46,14 +46,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CustomerDeleteParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - */ + @JvmStatic fun none(): CustomerDeleteParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CustomerDeleteParams]. */ @JvmStatic fun builder() = Builder() } @@ -73,7 +68,10 @@ private constructor( additionalBodyProperties = customerDeleteParams.additionalBodyProperties.toMutableMap() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -199,17 +197,10 @@ private constructor( * Returns an immutable instance of [CustomerDeleteParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerDeleteParams = CustomerDeleteParams( - checkRequired("customerId", customerId), + customerId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -221,7 +212,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt index d4d8e8fca..c1a0a7cca 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to fetch customer details given an `external_customer_id` (see @@ -17,12 +18,12 @@ import java.util.Objects */ class CustomerFetchByExternalIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) fun _additionalHeaders(): Headers = additionalHeaders @@ -32,14 +33,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerFetchByExternalIdParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerFetchByExternalIdParams]. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -60,10 +58,16 @@ private constructor( customerFetchByExternalIdParams.additionalQueryParams.toBuilder() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -166,17 +170,10 @@ private constructor( * Returns an immutable instance of [CustomerFetchByExternalIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -184,7 +181,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt index fdfa378f3..5e196bf80 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to fetch customer details given an identifier. If the `Customer` is in the @@ -16,12 +17,12 @@ import java.util.Objects */ class CustomerFetchParams private constructor( - private val customerId: String, + private val customerId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) fun _additionalHeaders(): Headers = additionalHeaders @@ -31,14 +32,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CustomerFetchParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - */ + @JvmStatic fun none(): CustomerFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CustomerFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -56,7 +52,10 @@ private constructor( additionalQueryParams = customerFetchParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -160,17 +159,10 @@ private constructor( * Returns an immutable instance of [CustomerFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerFetchParams = CustomerFetchParams( - checkRequired("customerId", customerId), + customerId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -178,7 +170,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt index d2257aa46..5a614592b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Sync Orb's payment methods for the customer with their gateway. @@ -21,13 +21,13 @@ import java.util.Optional */ class CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams private constructor( - private val externalCustomerId: String, + private val externalCustomerId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -39,14 +39,13 @@ private constructor( companion object { + @JvmStatic + fun none(): CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams]. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -79,10 +78,16 @@ private constructor( .toMutableMap() } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * Alias for calling [Builder.externalCustomerId] with `externalCustomerId.orElse(null)`. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -208,17 +213,10 @@ private constructor( * [CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalCustomerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams( - checkRequired("externalCustomerId", externalCustomerId), + externalCustomerId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -230,7 +228,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> externalCustomerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt index fc8cf863e..12acc9c62 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Sync Orb's payment methods for the customer with their gateway. @@ -21,13 +21,13 @@ import java.util.Optional */ class CustomerSyncPaymentMethodsFromGatewayParams private constructor( - private val customerId: String, + private val customerId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -39,14 +39,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerSyncPaymentMethodsFromGatewayParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerSyncPaymentMethodsFromGatewayParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -72,7 +69,10 @@ private constructor( customerSyncPaymentMethodsFromGatewayParams.additionalBodyProperties.toMutableMap() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -198,17 +198,10 @@ private constructor( * Returns an immutable instance of [CustomerSyncPaymentMethodsFromGatewayParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerSyncPaymentMethodsFromGatewayParams = CustomerSyncPaymentMethodsFromGatewayParams( - checkRequired("customerId", customerId), + customerId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -220,7 +213,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } 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 ca045da8a..762713da6 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 @@ -40,13 +40,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerUpdateByExternalIdParams private constructor( - private val id: String, + private val id: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun id(): String = id + fun id(): Optional = Optional.ofNullable(id) /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server @@ -425,14 +425,11 @@ private constructor( companion object { + @JvmStatic fun none(): CustomerUpdateByExternalIdParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [CustomerUpdateByExternalIdParams]. - * - * The following fields are required: - * ```java - * .id() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -455,7 +452,10 @@ private constructor( customerUpdateByExternalIdParams.additionalQueryParams.toBuilder() } - fun id(id: String) = apply { this.id = id } + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) /** * Sets the entire request body. @@ -1089,17 +1089,10 @@ private constructor( * Returns an immutable instance of [CustomerUpdateByExternalIdParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams( - checkRequired("id", id), + id, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -1110,7 +1103,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> id + 0 -> id ?: "" else -> "" } 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 333aac388..9dc6e1e6f 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 @@ -41,13 +41,13 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerUpdateParams private constructor( - private val customerId: String, + private val customerId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun customerId(): String = customerId + fun customerId(): Optional = Optional.ofNullable(customerId) /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server @@ -426,14 +426,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CustomerUpdateParams]. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - */ + @JvmStatic fun none(): CustomerUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CustomerUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -453,7 +448,10 @@ private constructor( additionalQueryParams = customerUpdateParams.additionalQueryParams.toBuilder() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * Sets the entire request body. @@ -1087,17 +1085,10 @@ private constructor( * Returns an immutable instance of [CustomerUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerUpdateParams = CustomerUpdateParams( - checkRequired("customerId", customerId), + customerId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -1108,7 +1099,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> customerId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.kt index 2ede06065..81584e947 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.kt @@ -3,20 +3,22 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Fetch dimensional price group by external ID */ class DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams private constructor( - private val externalDimensionalPriceGroupId: String, + private val externalDimensionalPriceGroupId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalDimensionalPriceGroupId(): String = externalDimensionalPriceGroupId + fun externalDimensionalPriceGroupId(): Optional = + Optional.ofNullable(externalDimensionalPriceGroupId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +28,13 @@ private constructor( companion object { + @JvmStatic + fun none(): DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + builder().build() + /** * Returns a mutable builder for constructing an instance of * [DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams]. - * - * The following fields are required: - * ```java - * .externalDimensionalPriceGroupId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -62,10 +63,17 @@ private constructor( .toBuilder() } - fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String) = apply { + fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String?) = apply { this.externalDimensionalPriceGroupId = externalDimensionalPriceGroupId } + /** + * Alias for calling [Builder.externalDimensionalPriceGroupId] with + * `externalDimensionalPriceGroupId.orElse(null)`. + */ + fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: Optional) = + externalDimensionalPriceGroupId(externalDimensionalPriceGroupId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -169,17 +177,10 @@ private constructor( * [DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalDimensionalPriceGroupId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams( - checkRequired("externalDimensionalPriceGroupId", externalDimensionalPriceGroupId), + externalDimensionalPriceGroupId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -187,7 +188,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalDimensionalPriceGroupId + 0 -> externalDimensionalPriceGroupId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupRetrieveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupRetrieveParams.kt index 80e454bd0..9e5cfe974 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupRetrieveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupRetrieveParams.kt @@ -3,20 +3,21 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Fetch dimensional price group */ class DimensionalPriceGroupRetrieveParams private constructor( - private val dimensionalPriceGroupId: String, + private val dimensionalPriceGroupId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun dimensionalPriceGroupId(): String = dimensionalPriceGroupId + fun dimensionalPriceGroupId(): Optional = Optional.ofNullable(dimensionalPriceGroupId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +27,11 @@ private constructor( companion object { + @JvmStatic fun none(): DimensionalPriceGroupRetrieveParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [DimensionalPriceGroupRetrieveParams]. - * - * The following fields are required: - * ```java - * .dimensionalPriceGroupId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -55,10 +53,17 @@ private constructor( dimensionalPriceGroupRetrieveParams.additionalQueryParams.toBuilder() } - fun dimensionalPriceGroupId(dimensionalPriceGroupId: String) = apply { + fun dimensionalPriceGroupId(dimensionalPriceGroupId: String?) = apply { this.dimensionalPriceGroupId = dimensionalPriceGroupId } + /** + * Alias for calling [Builder.dimensionalPriceGroupId] with + * `dimensionalPriceGroupId.orElse(null)`. + */ + fun dimensionalPriceGroupId(dimensionalPriceGroupId: Optional) = + dimensionalPriceGroupId(dimensionalPriceGroupId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -161,17 +166,10 @@ private constructor( * Returns an immutable instance of [DimensionalPriceGroupRetrieveParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .dimensionalPriceGroupId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams( - checkRequired("dimensionalPriceGroupId", dimensionalPriceGroupId), + dimensionalPriceGroupId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -179,7 +177,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> dimensionalPriceGroupId + 0 -> dimensionalPriceGroupId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt index c97664fb4..65c4381d1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Closing a backfill makes the updated usage visible in Orb. Upon closing a backfill, Orb will @@ -18,13 +18,13 @@ import java.util.Optional */ class EventBackfillCloseParams private constructor( - private val backfillId: String, + private val backfillId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun backfillId(): String = backfillId + fun backfillId(): Optional = Optional.ofNullable(backfillId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -36,14 +36,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [EventBackfillCloseParams]. - * - * The following fields are required: - * ```java - * .backfillId() - * ``` - */ + @JvmStatic fun none(): EventBackfillCloseParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [EventBackfillCloseParams]. */ @JvmStatic fun builder() = Builder() } @@ -64,7 +59,10 @@ private constructor( eventBackfillCloseParams.additionalBodyProperties.toMutableMap() } - fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } + fun backfillId(backfillId: String?) = apply { this.backfillId = backfillId } + + /** Alias for calling [Builder.backfillId] with `backfillId.orElse(null)`. */ + fun backfillId(backfillId: Optional) = backfillId(backfillId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -190,17 +188,10 @@ private constructor( * Returns an immutable instance of [EventBackfillCloseParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .backfillId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): EventBackfillCloseParams = EventBackfillCloseParams( - checkRequired("backfillId", backfillId), + backfillId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -212,7 +203,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> backfillId + 0 -> backfillId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt index 30794a558..51ce17893 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt @@ -3,20 +3,21 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** This endpoint is used to fetch a backfill given an identifier. */ class EventBackfillFetchParams private constructor( - private val backfillId: String, + private val backfillId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun backfillId(): String = backfillId + fun backfillId(): Optional = Optional.ofNullable(backfillId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +27,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [EventBackfillFetchParams]. - * - * The following fields are required: - * ```java - * .backfillId() - * ``` - */ + @JvmStatic fun none(): EventBackfillFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [EventBackfillFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -51,7 +47,10 @@ private constructor( additionalQueryParams = eventBackfillFetchParams.additionalQueryParams.toBuilder() } - fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } + fun backfillId(backfillId: String?) = apply { this.backfillId = backfillId } + + /** Alias for calling [Builder.backfillId] with `backfillId.orElse(null)`. */ + fun backfillId(backfillId: Optional) = backfillId(backfillId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -155,17 +154,10 @@ private constructor( * Returns an immutable instance of [EventBackfillFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .backfillId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): EventBackfillFetchParams = EventBackfillFetchParams( - checkRequired("backfillId", backfillId), + backfillId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -173,7 +165,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> backfillId + 0 -> backfillId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt index 2e450d0d3..6eb57fe24 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Reverting a backfill undoes all the effects of closing the backfill. If the backfill is @@ -21,13 +21,13 @@ import java.util.Optional */ class EventBackfillRevertParams private constructor( - private val backfillId: String, + private val backfillId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun backfillId(): String = backfillId + fun backfillId(): Optional = Optional.ofNullable(backfillId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -39,13 +39,10 @@ private constructor( companion object { + @JvmStatic fun none(): EventBackfillRevertParams = builder().build() + /** * Returns a mutable builder for constructing an instance of [EventBackfillRevertParams]. - * - * The following fields are required: - * ```java - * .backfillId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -67,7 +64,10 @@ private constructor( eventBackfillRevertParams.additionalBodyProperties.toMutableMap() } - fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } + fun backfillId(backfillId: String?) = apply { this.backfillId = backfillId } + + /** Alias for calling [Builder.backfillId] with `backfillId.orElse(null)`. */ + fun backfillId(backfillId: Optional) = backfillId(backfillId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -193,17 +193,10 @@ private constructor( * Returns an immutable instance of [EventBackfillRevertParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .backfillId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): EventBackfillRevertParams = EventBackfillRevertParams( - checkRequired("backfillId", backfillId), + backfillId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -215,7 +208,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> backfillId + 0 -> backfillId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt index acb0ed12a..5b8d9e4f2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to deprecate a single usage event with a given `event_id`. `event_id` @@ -47,13 +47,13 @@ import java.util.Optional */ class EventDeprecateParams private constructor( - private val eventId: String, + private val eventId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun eventId(): String = eventId + fun eventId(): Optional = Optional.ofNullable(eventId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -65,14 +65,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [EventDeprecateParams]. - * - * The following fields are required: - * ```java - * .eventId() - * ``` - */ + @JvmStatic fun none(): EventDeprecateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [EventDeprecateParams]. */ @JvmStatic fun builder() = Builder() } @@ -92,7 +87,10 @@ private constructor( additionalBodyProperties = eventDeprecateParams.additionalBodyProperties.toMutableMap() } - fun eventId(eventId: String) = apply { this.eventId = eventId } + fun eventId(eventId: String?) = apply { this.eventId = eventId } + + /** Alias for calling [Builder.eventId] with `eventId.orElse(null)`. */ + fun eventId(eventId: Optional) = eventId(eventId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -218,17 +216,10 @@ private constructor( * Returns an immutable instance of [EventDeprecateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .eventId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): EventDeprecateParams = EventDeprecateParams( - checkRequired("eventId", eventId), + eventId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -240,7 +231,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> eventId + 0 -> eventId ?: "" else -> "" } 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 80e738e89..7aa725350 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 @@ -62,13 +62,13 @@ import kotlin.jvm.optionals.getOrNull */ class EventUpdateParams private constructor( - private val eventId: String, + private val eventId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun eventId(): String = eventId + fun eventId(): Optional = Optional.ofNullable(eventId) /** * A name to meaningfully identify the action or event type. @@ -154,7 +154,6 @@ private constructor( * * The following fields are required: * ```java - * .eventId() * .eventName() * .properties() * .timestamp() @@ -179,7 +178,10 @@ private constructor( additionalQueryParams = eventUpdateParams.additionalQueryParams.toBuilder() } - fun eventId(eventId: String) = apply { this.eventId = eventId } + fun eventId(eventId: String?) = apply { this.eventId = eventId } + + /** Alias for calling [Builder.eventId] with `eventId.orElse(null)`. */ + fun eventId(eventId: Optional) = eventId(eventId.getOrNull()) /** * Sets the entire request body. @@ -390,7 +392,6 @@ private constructor( * * The following fields are required: * ```java - * .eventId() * .eventName() * .properties() * .timestamp() @@ -400,7 +401,7 @@ private constructor( */ fun build(): EventUpdateParams = EventUpdateParams( - checkRequired("eventId", eventId), + eventId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -411,7 +412,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> eventId + 0 -> eventId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt index 4b2fee35c..88d3083a2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt @@ -3,20 +3,21 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** This endpoint is used to fetch an [`Invoice`](/core-concepts#invoice) given an identifier. */ class InvoiceFetchParams private constructor( - private val invoiceId: String, + private val invoiceId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun invoiceId(): String = invoiceId + fun invoiceId(): Optional = Optional.ofNullable(invoiceId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +27,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [InvoiceFetchParams]. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - */ + @JvmStatic fun none(): InvoiceFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InvoiceFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -51,7 +47,10 @@ private constructor( additionalQueryParams = invoiceFetchParams.additionalQueryParams.toBuilder() } - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String?) = apply { this.invoiceId = invoiceId } + + /** Alias for calling [Builder.invoiceId] with `invoiceId.orElse(null)`. */ + fun invoiceId(invoiceId: Optional) = invoiceId(invoiceId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -155,25 +154,14 @@ private constructor( * Returns an immutable instance of [InvoiceFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): InvoiceFetchParams = - InvoiceFetchParams( - checkRequired("invoiceId", invoiceId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + InvoiceFetchParams(invoiceId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> invoiceId + 0 -> invoiceId ?: "" else -> "" } 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 4b982d835..5bbf2121a 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 @@ -11,13 +11,13 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint allows an eligible invoice to be issued manually. This is only possible with @@ -28,13 +28,13 @@ import java.util.Optional */ class InvoiceIssueParams private constructor( - private val invoiceId: String, + private val invoiceId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun invoiceId(): String = invoiceId + fun invoiceId(): Optional = Optional.ofNullable(invoiceId) /** * If true, the invoice will be issued synchronously. If false, the invoice will be issued @@ -64,14 +64,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [InvoiceIssueParams]. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - */ + @JvmStatic fun none(): InvoiceIssueParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InvoiceIssueParams]. */ @JvmStatic fun builder() = Builder() } @@ -91,7 +86,10 @@ private constructor( additionalQueryParams = invoiceIssueParams.additionalQueryParams.toBuilder() } - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String?) = apply { this.invoiceId = invoiceId } + + /** Alias for calling [Builder.invoiceId] with `invoiceId.orElse(null)`. */ + fun invoiceId(invoiceId: Optional) = invoiceId(invoiceId.getOrNull()) /** * Sets the entire request body. @@ -240,17 +238,10 @@ private constructor( * Returns an immutable instance of [InvoiceIssueParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): InvoiceIssueParams = InvoiceIssueParams( - checkRequired("invoiceId", invoiceId), + invoiceId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -261,7 +252,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> invoiceId + 0 -> invoiceId ?: "" else -> "" } 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 70baf6a62..aa7500b77 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 @@ -27,13 +27,13 @@ import kotlin.jvm.optionals.getOrNull */ class InvoiceMarkPaidParams private constructor( - private val invoiceId: String, + private val invoiceId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun invoiceId(): String = invoiceId + fun invoiceId(): Optional = Optional.ofNullable(invoiceId) /** * A date string to specify the date of the payment. @@ -96,7 +96,6 @@ private constructor( * * The following fields are required: * ```java - * .invoiceId() * .paymentReceivedDate() * ``` */ @@ -119,7 +118,10 @@ private constructor( additionalQueryParams = invoiceMarkPaidParams.additionalQueryParams.toBuilder() } - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String?) = apply { this.invoiceId = invoiceId } + + /** Alias for calling [Builder.invoiceId] with `invoiceId.orElse(null)`. */ + fun invoiceId(invoiceId: Optional) = invoiceId(invoiceId.getOrNull()) /** * Sets the entire request body. @@ -301,7 +303,6 @@ private constructor( * * The following fields are required: * ```java - * .invoiceId() * .paymentReceivedDate() * ``` * @@ -309,7 +310,7 @@ private constructor( */ fun build(): InvoiceMarkPaidParams = InvoiceMarkPaidParams( - checkRequired("invoiceId", invoiceId), + invoiceId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -320,7 +321,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> invoiceId + 0 -> invoiceId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt index d0ad59ccc..1328a2ff9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint collects payment for an invoice using the customer's default payment method. This @@ -17,13 +17,13 @@ import java.util.Optional */ class InvoicePayParams private constructor( - private val invoiceId: String, + private val invoiceId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun invoiceId(): String = invoiceId + fun invoiceId(): Optional = Optional.ofNullable(invoiceId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -35,14 +35,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [InvoicePayParams]. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - */ + @JvmStatic fun none(): InvoicePayParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InvoicePayParams]. */ @JvmStatic fun builder() = Builder() } @@ -62,7 +57,10 @@ private constructor( additionalBodyProperties = invoicePayParams.additionalBodyProperties.toMutableMap() } - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String?) = apply { this.invoiceId = invoiceId } + + /** Alias for calling [Builder.invoiceId] with `invoiceId.orElse(null)`. */ + fun invoiceId(invoiceId: Optional) = invoiceId(invoiceId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -188,17 +186,10 @@ private constructor( * Returns an immutable instance of [InvoicePayParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): InvoicePayParams = InvoicePayParams( - checkRequired("invoiceId", invoiceId), + invoiceId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -210,7 +201,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> invoiceId + 0 -> invoiceId ?: "" else -> "" } 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 c8d560f41..7ec4c10d4 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -29,13 +28,13 @@ import kotlin.jvm.optionals.getOrNull */ class InvoiceUpdateParams private constructor( - private val invoiceId: String, + private val invoiceId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun invoiceId(): String = invoiceId + fun invoiceId(): Optional = Optional.ofNullable(invoiceId) /** * User-specified key/value pairs for the resource. Individual keys can be removed by setting @@ -64,14 +63,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [InvoiceUpdateParams]. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - */ + @JvmStatic fun none(): InvoiceUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InvoiceUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -91,7 +85,10 @@ private constructor( additionalQueryParams = invoiceUpdateParams.additionalQueryParams.toBuilder() } - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String?) = apply { this.invoiceId = invoiceId } + + /** Alias for calling [Builder.invoiceId] with `invoiceId.orElse(null)`. */ + fun invoiceId(invoiceId: Optional) = invoiceId(invoiceId.getOrNull()) /** * Sets the entire request body. @@ -242,17 +239,10 @@ private constructor( * Returns an immutable instance of [InvoiceUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): InvoiceUpdateParams = InvoiceUpdateParams( - checkRequired("invoiceId", invoiceId), + invoiceId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -263,7 +253,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> invoiceId + 0 -> invoiceId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt index 3ecd331df..6824d660d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint allows an invoice's status to be set the `void` status. This can only be done to @@ -24,13 +24,13 @@ import java.util.Optional */ class InvoiceVoidInvoiceParams private constructor( - private val invoiceId: String, + private val invoiceId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun invoiceId(): String = invoiceId + fun invoiceId(): Optional = Optional.ofNullable(invoiceId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -42,14 +42,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [InvoiceVoidInvoiceParams]. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - */ + @JvmStatic fun none(): InvoiceVoidInvoiceParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [InvoiceVoidInvoiceParams]. */ @JvmStatic fun builder() = Builder() } @@ -70,7 +65,10 @@ private constructor( invoiceVoidInvoiceParams.additionalBodyProperties.toMutableMap() } - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String?) = apply { this.invoiceId = invoiceId } + + /** Alias for calling [Builder.invoiceId] with `invoiceId.orElse(null)`. */ + fun invoiceId(invoiceId: Optional) = invoiceId(invoiceId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -196,17 +194,10 @@ private constructor( * Returns an immutable instance of [InvoiceVoidInvoiceParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .invoiceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams( - checkRequired("invoiceId", invoiceId), + invoiceId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -218,7 +209,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> invoiceId + 0 -> invoiceId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt index 8d1f7aa43..2576c3bf4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt @@ -3,20 +3,21 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** This endpoint returns an item identified by its item_id. */ class ItemFetchParams private constructor( - private val itemId: String, + private val itemId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun itemId(): String = itemId + fun itemId(): Optional = Optional.ofNullable(itemId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +27,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [ItemFetchParams]. - * - * The following fields are required: - * ```java - * .itemId() - * ``` - */ + @JvmStatic fun none(): ItemFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [ItemFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -51,7 +47,10 @@ private constructor( additionalQueryParams = itemFetchParams.additionalQueryParams.toBuilder() } - fun itemId(itemId: String) = apply { this.itemId = itemId } + fun itemId(itemId: String?) = apply { this.itemId = itemId } + + /** Alias for calling [Builder.itemId] with `itemId.orElse(null)`. */ + fun itemId(itemId: Optional) = itemId(itemId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -155,25 +154,14 @@ private constructor( * Returns an immutable instance of [ItemFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .itemId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): ItemFetchParams = - ItemFetchParams( - checkRequired("itemId", itemId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + ItemFetchParams(itemId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> itemId + 0 -> itemId ?: "" else -> "" } 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 3d5f28587..4982da3f0 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 @@ -26,13 +26,13 @@ import kotlin.jvm.optionals.getOrNull /** This endpoint can be used to update properties on the Item. */ class ItemUpdateParams private constructor( - private val itemId: String, + private val itemId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun itemId(): String = itemId + fun itemId(): Optional = Optional.ofNullable(itemId) /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server @@ -71,14 +71,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [ItemUpdateParams]. - * - * The following fields are required: - * ```java - * .itemId() - * ``` - */ + @JvmStatic fun none(): ItemUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [ItemUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -98,7 +93,10 @@ private constructor( additionalQueryParams = itemUpdateParams.additionalQueryParams.toBuilder() } - fun itemId(itemId: String) = apply { this.itemId = itemId } + fun itemId(itemId: String?) = apply { this.itemId = itemId } + + /** Alias for calling [Builder.itemId] with `itemId.orElse(null)`. */ + fun itemId(itemId: Optional) = itemId(itemId.getOrNull()) /** * Sets the entire request body. @@ -274,17 +272,10 @@ private constructor( * Returns an immutable instance of [ItemUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .itemId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): ItemUpdateParams = ItemUpdateParams( - checkRequired("itemId", itemId), + itemId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -295,7 +286,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> itemId + 0 -> itemId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt index 10e97ce00..91f6de6be 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to list [metrics](/core-concepts#metric). It returns information about the @@ -14,12 +15,12 @@ import java.util.Objects */ class MetricFetchParams private constructor( - private val metricId: String, + private val metricId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun metricId(): String = metricId + fun metricId(): Optional = Optional.ofNullable(metricId) fun _additionalHeaders(): Headers = additionalHeaders @@ -29,14 +30,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [MetricFetchParams]. - * - * The following fields are required: - * ```java - * .metricId() - * ``` - */ + @JvmStatic fun none(): MetricFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [MetricFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -54,7 +50,10 @@ private constructor( additionalQueryParams = metricFetchParams.additionalQueryParams.toBuilder() } - fun metricId(metricId: String) = apply { this.metricId = metricId } + fun metricId(metricId: String?) = apply { this.metricId = metricId } + + /** Alias for calling [Builder.metricId] with `metricId.orElse(null)`. */ + fun metricId(metricId: Optional) = metricId(metricId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -158,25 +157,14 @@ private constructor( * Returns an immutable instance of [MetricFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .metricId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): MetricFetchParams = - MetricFetchParams( - checkRequired("metricId", metricId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + MetricFetchParams(metricId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> metricId + 0 -> metricId ?: "" else -> "" } 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 d5b33a4ca..83328fbf3 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -27,13 +26,13 @@ import kotlin.jvm.optionals.getOrNull */ class MetricUpdateParams private constructor( - private val metricId: String, + private val metricId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun metricId(): String = metricId + fun metricId(): Optional = Optional.ofNullable(metricId) /** * User-specified key/value pairs for the resource. Individual keys can be removed by setting @@ -62,14 +61,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [MetricUpdateParams]. - * - * The following fields are required: - * ```java - * .metricId() - * ``` - */ + @JvmStatic fun none(): MetricUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [MetricUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -89,7 +83,10 @@ private constructor( additionalQueryParams = metricUpdateParams.additionalQueryParams.toBuilder() } - fun metricId(metricId: String) = apply { this.metricId = metricId } + fun metricId(metricId: String?) = apply { this.metricId = metricId } + + /** Alias for calling [Builder.metricId] with `metricId.orElse(null)`. */ + fun metricId(metricId: Optional) = metricId(metricId.getOrNull()) /** * Sets the entire request body. @@ -240,17 +237,10 @@ private constructor( * Returns an immutable instance of [MetricUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .metricId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): MetricUpdateParams = MetricUpdateParams( - checkRequired("metricId", metricId), + metricId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -261,7 +251,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> metricId + 0 -> metricId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt index 1ef99371b..1c3d068df 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details given an @@ -26,12 +27,12 @@ import java.util.Objects */ class PlanExternalPlanIdFetchParams private constructor( - private val externalPlanId: String, + private val externalPlanId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalPlanId(): String = externalPlanId + fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId) fun _additionalHeaders(): Headers = additionalHeaders @@ -41,14 +42,11 @@ private constructor( companion object { + @JvmStatic fun none(): PlanExternalPlanIdFetchParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [PlanExternalPlanIdFetchParams]. - * - * The following fields are required: - * ```java - * .externalPlanId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -67,7 +65,11 @@ private constructor( additionalQueryParams = planExternalPlanIdFetchParams.additionalQueryParams.toBuilder() } - fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: String?) = apply { this.externalPlanId = externalPlanId } + + /** Alias for calling [Builder.externalPlanId] with `externalPlanId.orElse(null)`. */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -171,17 +173,10 @@ private constructor( * Returns an immutable instance of [PlanExternalPlanIdFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalPlanId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams( - checkRequired("externalPlanId", externalPlanId), + externalPlanId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -189,7 +184,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalPlanId + 0 -> externalPlanId ?: "" else -> "" } 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 eadfb19ff..a82ba3004 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -28,13 +27,13 @@ import kotlin.jvm.optionals.getOrNull */ class PlanExternalPlanIdUpdateParams private constructor( - private val otherExternalPlanId: String, + private val otherExternalPlanId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun otherExternalPlanId(): String = otherExternalPlanId + fun otherExternalPlanId(): Optional = Optional.ofNullable(otherExternalPlanId) /** * An optional user-defined ID for this plan resource, used throughout the system as an alias @@ -79,14 +78,11 @@ private constructor( companion object { + @JvmStatic fun none(): PlanExternalPlanIdUpdateParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [PlanExternalPlanIdUpdateParams]. - * - * The following fields are required: - * ```java - * .otherExternalPlanId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -107,10 +103,16 @@ private constructor( additionalQueryParams = planExternalPlanIdUpdateParams.additionalQueryParams.toBuilder() } - fun otherExternalPlanId(otherExternalPlanId: String) = apply { + fun otherExternalPlanId(otherExternalPlanId: String?) = apply { this.otherExternalPlanId = otherExternalPlanId } + /** + * Alias for calling [Builder.otherExternalPlanId] with `otherExternalPlanId.orElse(null)`. + */ + fun otherExternalPlanId(otherExternalPlanId: Optional) = + otherExternalPlanId(otherExternalPlanId.getOrNull()) + /** * Sets the entire request body. * @@ -283,17 +285,10 @@ private constructor( * Returns an immutable instance of [PlanExternalPlanIdUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .otherExternalPlanId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams( - checkRequired("otherExternalPlanId", otherExternalPlanId), + otherExternalPlanId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -304,7 +299,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> otherExternalPlanId + 0 -> otherExternalPlanId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt index 94bd31a97..a6427bb01 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to fetch [plan](/core-concepts#plan-and-price) details given a plan @@ -27,12 +28,12 @@ import java.util.Objects */ class PlanFetchParams private constructor( - private val planId: String, + private val planId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun planId(): String = planId + fun planId(): Optional = Optional.ofNullable(planId) fun _additionalHeaders(): Headers = additionalHeaders @@ -42,14 +43,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [PlanFetchParams]. - * - * The following fields are required: - * ```java - * .planId() - * ``` - */ + @JvmStatic fun none(): PlanFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [PlanFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -67,7 +63,10 @@ private constructor( additionalQueryParams = planFetchParams.additionalQueryParams.toBuilder() } - fun planId(planId: String) = apply { this.planId = planId } + fun planId(planId: String?) = apply { this.planId = planId } + + /** Alias for calling [Builder.planId] with `planId.orElse(null)`. */ + fun planId(planId: Optional) = planId(planId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -171,25 +170,14 @@ private constructor( * Returns an immutable instance of [PlanFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .planId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PlanFetchParams = - PlanFetchParams( - checkRequired("planId", planId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + PlanFetchParams(planId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> planId + 0 -> planId ?: "" else -> "" } 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 f47ff136b..25b9bd6d4 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -28,13 +27,13 @@ import kotlin.jvm.optionals.getOrNull */ class PlanUpdateParams private constructor( - private val planId: String, + private val planId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun planId(): String = planId + fun planId(): Optional = Optional.ofNullable(planId) /** * An optional user-defined ID for this plan resource, used throughout the system as an alias @@ -79,14 +78,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [PlanUpdateParams]. - * - * The following fields are required: - * ```java - * .planId() - * ``` - */ + @JvmStatic fun none(): PlanUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [PlanUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -106,7 +100,10 @@ private constructor( additionalQueryParams = planUpdateParams.additionalQueryParams.toBuilder() } - fun planId(planId: String) = apply { this.planId = planId } + fun planId(planId: String?) = apply { this.planId = planId } + + /** Alias for calling [Builder.planId] with `planId.orElse(null)`. */ + fun planId(planId: Optional) = planId(planId.getOrNull()) /** * Sets the entire request body. @@ -280,17 +277,10 @@ private constructor( * Returns an immutable instance of [PlanUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .planId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PlanUpdateParams = PlanUpdateParams( - checkRequired("planId", planId), + planId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -301,7 +291,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> planId + 0 -> planId ?: "" else -> "" } 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 9b4dd1026..2e0cc4af7 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 @@ -44,13 +44,13 @@ import kotlin.jvm.optionals.getOrNull */ class PriceEvaluateParams private constructor( - private val priceId: String, + private val priceId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun priceId(): String = priceId + fun priceId(): Optional = Optional.ofNullable(priceId) /** * The exclusive upper bound for event timestamps @@ -160,7 +160,6 @@ private constructor( * * The following fields are required: * ```java - * .priceId() * .timeframeEnd() * .timeframeStart() * ``` @@ -184,7 +183,10 @@ private constructor( additionalQueryParams = priceEvaluateParams.additionalQueryParams.toBuilder() } - fun priceId(priceId: String) = apply { this.priceId = priceId } + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** Alias for calling [Builder.priceId] with `priceId.orElse(null)`. */ + fun priceId(priceId: Optional) = priceId(priceId.getOrNull()) /** * Sets the entire request body. @@ -433,7 +435,6 @@ private constructor( * * The following fields are required: * ```java - * .priceId() * .timeframeEnd() * .timeframeStart() * ``` @@ -442,7 +443,7 @@ private constructor( */ fun build(): PriceEvaluateParams = PriceEvaluateParams( - checkRequired("priceId", priceId), + priceId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -453,7 +454,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> priceId + 0 -> priceId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt index 4beee51b6..bdbe10025 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint returns a price given an external price id. See the @@ -15,12 +16,12 @@ import java.util.Objects */ class PriceExternalPriceIdFetchParams private constructor( - private val externalPriceId: String, + private val externalPriceId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalPriceId(): String = externalPriceId + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) fun _additionalHeaders(): Headers = additionalHeaders @@ -30,14 +31,11 @@ private constructor( companion object { + @JvmStatic fun none(): PriceExternalPriceIdFetchParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [PriceExternalPriceIdFetchParams]. - * - * The following fields are required: - * ```java - * .externalPriceId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -58,10 +56,14 @@ private constructor( priceExternalPriceIdFetchParams.additionalQueryParams.toBuilder() } - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** Alias for calling [Builder.externalPriceId] with `externalPriceId.orElse(null)`. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -164,17 +166,10 @@ private constructor( * Returns an immutable instance of [PriceExternalPriceIdFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalPriceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams( - checkRequired("externalPriceId", externalPriceId), + externalPriceId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -182,7 +177,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalPriceId + 0 -> externalPriceId ?: "" else -> "" } 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 8b82adefa..9775d92b1 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -27,13 +26,13 @@ import kotlin.jvm.optionals.getOrNull */ class PriceExternalPriceIdUpdateParams private constructor( - private val externalPriceId: String, + private val externalPriceId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun externalPriceId(): String = externalPriceId + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) /** * User-specified key/value pairs for the resource. Individual keys can be removed by setting @@ -62,14 +61,11 @@ private constructor( companion object { + @JvmStatic fun none(): PriceExternalPriceIdUpdateParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [PriceExternalPriceIdUpdateParams]. - * - * The following fields are required: - * ```java - * .externalPriceId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -92,10 +88,14 @@ private constructor( priceExternalPriceIdUpdateParams.additionalQueryParams.toBuilder() } - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** Alias for calling [Builder.externalPriceId] with `externalPriceId.orElse(null)`. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.getOrNull()) + /** * Sets the entire request body. * @@ -245,17 +245,10 @@ private constructor( * Returns an immutable instance of [PriceExternalPriceIdUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .externalPriceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams( - checkRequired("externalPriceId", externalPriceId), + externalPriceId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -266,7 +259,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> externalPriceId + 0 -> externalPriceId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt index 0597f89e1..9f4831e6c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt @@ -3,20 +3,21 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** This endpoint returns a price given an identifier. */ class PriceFetchParams private constructor( - private val priceId: String, + private val priceId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun priceId(): String = priceId + fun priceId(): Optional = Optional.ofNullable(priceId) fun _additionalHeaders(): Headers = additionalHeaders @@ -26,14 +27,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [PriceFetchParams]. - * - * The following fields are required: - * ```java - * .priceId() - * ``` - */ + @JvmStatic fun none(): PriceFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [PriceFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -51,7 +47,10 @@ private constructor( additionalQueryParams = priceFetchParams.additionalQueryParams.toBuilder() } - fun priceId(priceId: String) = apply { this.priceId = priceId } + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** Alias for calling [Builder.priceId] with `priceId.orElse(null)`. */ + fun priceId(priceId: Optional) = priceId(priceId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -155,25 +154,14 @@ private constructor( * Returns an immutable instance of [PriceFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .priceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PriceFetchParams = - PriceFetchParams( - checkRequired("priceId", priceId), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + PriceFetchParams(priceId, additionalHeaders.build(), additionalQueryParams.build()) } fun _pathParam(index: Int): String = when (index) { - 0 -> priceId + 0 -> priceId ?: "" else -> "" } 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 a73648e2e..96660b947 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -27,13 +26,13 @@ import kotlin.jvm.optionals.getOrNull */ class PriceUpdateParams private constructor( - private val priceId: String, + private val priceId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun priceId(): String = priceId + fun priceId(): Optional = Optional.ofNullable(priceId) /** * User-specified key/value pairs for the resource. Individual keys can be removed by setting @@ -62,14 +61,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [PriceUpdateParams]. - * - * The following fields are required: - * ```java - * .priceId() - * ``` - */ + @JvmStatic fun none(): PriceUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [PriceUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -89,7 +83,10 @@ private constructor( additionalQueryParams = priceUpdateParams.additionalQueryParams.toBuilder() } - fun priceId(priceId: String) = apply { this.priceId = priceId } + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** Alias for calling [Builder.priceId] with `priceId.orElse(null)`. */ + fun priceId(priceId: Optional) = priceId(priceId.getOrNull()) /** * Sets the entire request body. @@ -240,17 +237,10 @@ private constructor( * Returns an immutable instance of [PriceUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .priceId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): PriceUpdateParams = PriceUpdateParams( - checkRequired("priceId", priceId), + priceId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -261,7 +251,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> priceId + 0 -> priceId ?: "" else -> "" } 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 983b9bc36..ccc316689 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 @@ -75,13 +75,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionCancelParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * Determines the timing of subscription cancellation @@ -148,7 +148,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .cancelOption() * ``` */ @@ -171,7 +170,11 @@ private constructor( additionalQueryParams = subscriptionCancelParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -380,7 +383,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .cancelOption() * ``` * @@ -388,7 +390,7 @@ private constructor( */ fun build(): SubscriptionCancelParams = SubscriptionCancelParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -399,7 +401,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyParams.kt index 986120fad..554f3ac58 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyParams.kt @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -27,13 +26,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionChangeApplyParams private constructor( - private val subscriptionChangeId: String, + private val subscriptionChangeId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionChangeId(): String = subscriptionChangeId + fun subscriptionChangeId(): Optional = Optional.ofNullable(subscriptionChangeId) /** * Description to apply to the balance transaction representing this credit. @@ -76,14 +75,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionChangeApplyParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionChangeApplyParams]. - * - * The following fields are required: - * ```java - * .subscriptionChangeId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -104,10 +100,17 @@ private constructor( additionalQueryParams = subscriptionChangeApplyParams.additionalQueryParams.toBuilder() } - fun subscriptionChangeId(subscriptionChangeId: String) = apply { + fun subscriptionChangeId(subscriptionChangeId: String?) = apply { this.subscriptionChangeId = subscriptionChangeId } + /** + * Alias for calling [Builder.subscriptionChangeId] with + * `subscriptionChangeId.orElse(null)`. + */ + fun subscriptionChangeId(subscriptionChangeId: Optional) = + subscriptionChangeId(subscriptionChangeId.getOrNull()) + /** * Sets the entire request body. * @@ -277,17 +280,10 @@ private constructor( * Returns an immutable instance of [SubscriptionChangeApplyParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionChangeId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionChangeApplyParams = SubscriptionChangeApplyParams( - checkRequired("subscriptionChangeId", subscriptionChangeId), + subscriptionChangeId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -298,7 +294,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionChangeId + 0 -> subscriptionChangeId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelParams.kt index 8e7d29406..d5b2dc6a3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Cancel a subscription change. The change can no longer be applied. A subscription can only have @@ -18,13 +18,13 @@ import java.util.Optional */ class SubscriptionChangeCancelParams private constructor( - private val subscriptionChangeId: String, + private val subscriptionChangeId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun subscriptionChangeId(): String = subscriptionChangeId + fun subscriptionChangeId(): Optional = Optional.ofNullable(subscriptionChangeId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -36,14 +36,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionChangeCancelParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionChangeCancelParams]. - * - * The following fields are required: - * ```java - * .subscriptionChangeId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -65,10 +62,17 @@ private constructor( subscriptionChangeCancelParams.additionalBodyProperties.toMutableMap() } - fun subscriptionChangeId(subscriptionChangeId: String) = apply { + fun subscriptionChangeId(subscriptionChangeId: String?) = apply { this.subscriptionChangeId = subscriptionChangeId } + /** + * Alias for calling [Builder.subscriptionChangeId] with + * `subscriptionChangeId.orElse(null)`. + */ + fun subscriptionChangeId(subscriptionChangeId: Optional) = + subscriptionChangeId(subscriptionChangeId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -193,17 +197,10 @@ private constructor( * Returns an immutable instance of [SubscriptionChangeCancelParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionChangeId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionChangeCancelParams = SubscriptionChangeCancelParams( - checkRequired("subscriptionChangeId", subscriptionChangeId), + subscriptionChangeId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -215,7 +212,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionChangeId + 0 -> subscriptionChangeId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveParams.kt index 91cf124c6..ec3ab846d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint returns a subscription change given an identifier. @@ -19,12 +20,12 @@ import java.util.Objects */ class SubscriptionChangeRetrieveParams private constructor( - private val subscriptionChangeId: String, + private val subscriptionChangeId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionChangeId(): String = subscriptionChangeId + fun subscriptionChangeId(): Optional = Optional.ofNullable(subscriptionChangeId) fun _additionalHeaders(): Headers = additionalHeaders @@ -34,14 +35,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionChangeRetrieveParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionChangeRetrieveParams]. - * - * The following fields are required: - * ```java - * .subscriptionChangeId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -62,10 +60,17 @@ private constructor( subscriptionChangeRetrieveParams.additionalQueryParams.toBuilder() } - fun subscriptionChangeId(subscriptionChangeId: String) = apply { + fun subscriptionChangeId(subscriptionChangeId: String?) = apply { this.subscriptionChangeId = subscriptionChangeId } + /** + * Alias for calling [Builder.subscriptionChangeId] with + * `subscriptionChangeId.orElse(null)`. + */ + fun subscriptionChangeId(subscriptionChangeId: Optional) = + subscriptionChangeId(subscriptionChangeId.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -168,17 +173,10 @@ private constructor( * Returns an immutable instance of [SubscriptionChangeRetrieveParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionChangeId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams( - checkRequired("subscriptionChangeId", subscriptionChangeId), + subscriptionChangeId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -186,7 +184,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionChangeId + 0 -> subscriptionChangeId ?: "" else -> "" } 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 2569032e9..edd314d23 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 @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -29,7 +28,7 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionFetchCostsParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val currency: String?, private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, @@ -38,7 +37,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** The currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) @@ -64,13 +63,10 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionFetchCostsParams = builder().build() + /** * Returns a mutable builder for constructing an instance of [SubscriptionFetchCostsParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -97,7 +93,11 @@ private constructor( additionalQueryParams = subscriptionFetchCostsParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** The currency or custom pricing unit to use. */ fun currency(currency: String?) = apply { this.currency = currency } @@ -233,17 +233,10 @@ private constructor( * Returns an immutable instance of [SubscriptionFetchCostsParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionFetchCostsParams = SubscriptionFetchCostsParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, currency, timeframeEnd, timeframeStart, @@ -255,7 +248,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt index ac66b2f8b..f107bdd6d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt @@ -3,10 +3,11 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint is used to fetch a [Subscription](/core-concepts##subscription) given an @@ -14,12 +15,12 @@ import java.util.Objects */ class SubscriptionFetchParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) fun _additionalHeaders(): Headers = additionalHeaders @@ -29,14 +30,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [SubscriptionFetchParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - */ + @JvmStatic fun none(): SubscriptionFetchParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SubscriptionFetchParams]. */ @JvmStatic fun builder() = Builder() } @@ -54,7 +50,11 @@ private constructor( additionalQueryParams = subscriptionFetchParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -158,17 +158,10 @@ private constructor( * Returns an immutable instance of [SubscriptionFetchParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionFetchParams = SubscriptionFetchParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -176,7 +169,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 227b32c0f..159f4d537 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 @@ -3,7 +3,6 @@ package com.withorb.api.models import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import java.time.OffsetDateTime @@ -19,7 +18,7 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionFetchScheduleParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val cursor: String?, private val limit: Long?, private val startDateGt: OffsetDateTime?, @@ -30,7 +29,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -57,14 +56,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionFetchScheduleParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionFetchScheduleParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -97,7 +93,11 @@ private constructor( subscriptionFetchScheduleParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the @@ -247,17 +247,10 @@ private constructor( * Returns an immutable instance of [SubscriptionFetchScheduleParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, cursor, limit, startDateGt, @@ -271,7 +264,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 89a711c3b..531312c38 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 @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -194,7 +193,7 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionFetchUsageParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val billableMetricId: String?, private val firstDimensionKey: String?, private val firstDimensionValue: String?, @@ -209,7 +208,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * When specified in conjunction with `group_by`, this parameter filters usage to a single @@ -253,13 +252,10 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionFetchUsageParams = builder().build() + /** * Returns a mutable builder for constructing an instance of [SubscriptionFetchUsageParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -298,7 +294,11 @@ private constructor( additionalQueryParams = subscriptionFetchUsageParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * When specified in conjunction with `group_by`, this parameter filters usage to a single @@ -492,17 +492,10 @@ private constructor( * Returns an immutable instance of [SubscriptionFetchUsageParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionFetchUsageParams = SubscriptionFetchUsageParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, billableMetricId, firstDimensionKey, firstDimensionValue, @@ -520,7 +513,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 648dc3c5b..0760beb50 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 @@ -102,13 +102,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionPriceIntervalsParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * A list of price intervals to add to the subscription. @@ -198,14 +198,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionPriceIntervalsParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionPriceIntervalsParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -228,7 +225,11 @@ private constructor( subscriptionPriceIntervalsParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -486,17 +487,10 @@ private constructor( * Returns an immutable instance of [SubscriptionPriceIntervalsParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -507,7 +501,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 e39ea22bd..b01f19960 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 @@ -196,13 +196,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionSchedulePlanChangeParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly @@ -652,7 +652,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .changeOption() * ``` */ @@ -678,7 +677,11 @@ private constructor( subscriptionSchedulePlanChangeParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -1535,7 +1538,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .changeOption() * ``` * @@ -1543,7 +1545,7 @@ private constructor( */ fun build(): SubscriptionSchedulePlanChangeParams = SubscriptionSchedulePlanChangeParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -1554,7 +1556,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 848386a23..c92bb5632 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException @@ -24,13 +23,13 @@ import kotlin.jvm.optionals.getOrNull /** Manually trigger a phase, effective the given date (or the current time, if not specified). */ class SubscriptionTriggerPhaseParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * If false, this request will fail if it would void an issued invoice or create a credit note. @@ -76,14 +75,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionTriggerPhaseParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionTriggerPhaseParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -104,7 +100,11 @@ private constructor( additionalQueryParams = subscriptionTriggerPhaseParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -293,17 +293,10 @@ private constructor( * Returns an immutable instance of [SubscriptionTriggerPhaseParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -314,7 +307,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt index 714841c7e..12927d894 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt @@ -4,12 +4,12 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint can be used to unschedule any pending cancellations for a subscription. @@ -20,13 +20,13 @@ import java.util.Optional */ class SubscriptionUnscheduleCancellationParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -38,14 +38,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionUnscheduleCancellationParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionUnscheduleCancellationParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -71,7 +68,11 @@ private constructor( subscriptionUnscheduleCancellationParams.additionalBodyProperties.toMutableMap() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -197,17 +198,10 @@ private constructor( * Returns an immutable instance of [SubscriptionUnscheduleCancellationParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionUnscheduleCancellationParams = SubscriptionUnscheduleCancellationParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -219,7 +213,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt index 2181822ed..b04fb9508 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt @@ -17,6 +17,8 @@ import com.withorb.api.core.http.QueryParams import com.withorb.api.errors.OrbInvalidDataException import java.util.Collections import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * This endpoint can be used to clear scheduled updates to the quantity for a fixed fee. @@ -26,13 +28,13 @@ import java.util.Objects */ class SubscriptionUnscheduleFixedFeeQuantityUpdatesParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * Price for which the updates should be cleared. Must be a fixed fee. @@ -65,7 +67,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .priceId() * ``` */ @@ -94,7 +95,11 @@ private constructor( .toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -240,7 +245,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .priceId() * ``` * @@ -248,7 +252,7 @@ private constructor( */ fun build(): SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = SubscriptionUnscheduleFixedFeeQuantityUpdatesParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -259,7 +263,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt index 925e9578e..c05025a0f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt @@ -4,23 +4,23 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** This endpoint can be used to unschedule any pending plan changes on an existing subscription. */ class SubscriptionUnschedulePendingPlanChangesParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -32,14 +32,11 @@ private constructor( companion object { + @JvmStatic fun none(): SubscriptionUnschedulePendingPlanChangesParams = builder().build() + /** * Returns a mutable builder for constructing an instance of * [SubscriptionUnschedulePendingPlanChangesParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` */ @JvmStatic fun builder() = Builder() } @@ -67,7 +64,11 @@ private constructor( .toMutableMap() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -193,17 +194,10 @@ private constructor( * Returns an immutable instance of [SubscriptionUnschedulePendingPlanChangesParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionUnschedulePendingPlanChangesParams = SubscriptionUnschedulePendingPlanChangesParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -215,7 +209,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 653b36409..1fd60e251 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 @@ -38,13 +38,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionUpdateFixedFeeQuantityParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * Price for which the quantity should be updated. Must be a fixed fee. @@ -142,7 +142,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .priceId() * .quantity() * ``` @@ -170,7 +169,11 @@ private constructor( subscriptionUpdateFixedFeeQuantityParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -406,7 +409,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .priceId() * .quantity() * ``` @@ -415,7 +417,7 @@ private constructor( */ fun build(): SubscriptionUpdateFixedFeeQuantityParams = SubscriptionUpdateFixedFeeQuantityParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -426,7 +428,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 aba211419..42c2c1ce8 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 @@ -11,7 +11,6 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.JsonMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.Params -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable @@ -27,13 +26,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionUpdateParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * Determines whether issued invoices for this subscription will automatically be charged with @@ -130,14 +129,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [SubscriptionUpdateParams]. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - */ + @JvmStatic fun none(): SubscriptionUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [SubscriptionUpdateParams]. */ @JvmStatic fun builder() = Builder() } @@ -157,7 +151,11 @@ private constructor( additionalQueryParams = subscriptionUpdateParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -418,17 +416,10 @@ private constructor( * Returns an immutable instance of [SubscriptionUpdateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .subscriptionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): SubscriptionUpdateParams = SubscriptionUpdateParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -439,7 +430,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } 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 b5db99bb1..783c38f91 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 @@ -53,13 +53,13 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionUpdateTrialParams private constructor( - private val subscriptionId: String, + private val subscriptionId: String?, private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun subscriptionId(): String = subscriptionId + fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) /** * The new date that the trial should end, or the literal string `immediate` to end the trial @@ -109,7 +109,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .trialEndDate() * ``` */ @@ -132,7 +131,11 @@ private constructor( additionalQueryParams = subscriptionUpdateTrialParams.additionalQueryParams.toBuilder() } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } + + /** Alias for calling [Builder.subscriptionId] with `subscriptionId.orElse(null)`. */ + fun subscriptionId(subscriptionId: Optional) = + subscriptionId(subscriptionId.getOrNull()) /** * Sets the entire request body. @@ -311,7 +314,6 @@ private constructor( * * The following fields are required: * ```java - * .subscriptionId() * .trialEndDate() * ``` * @@ -319,7 +321,7 @@ private constructor( */ fun build(): SubscriptionUpdateTrialParams = SubscriptionUpdateTrialParams( - checkRequired("subscriptionId", subscriptionId), + subscriptionId, body.build(), additionalHeaders.build(), additionalQueryParams.build(), @@ -330,7 +332,7 @@ private constructor( fun _pathParam(index: Int): String = when (index) { - 0 -> subscriptionId + 0 -> subscriptionId ?: "" else -> "" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsync.kt index c2b191907..62cc679b8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsync.kt @@ -25,8 +25,22 @@ interface AlertServiceAsync { fun withRawResponse(): WithRawResponse /** This endpoint retrieves an alert by its ID. */ - fun retrieve(params: AlertRetrieveParams): CompletableFuture = - retrieve(params, RequestOptions.none()) + fun retrieve(alertId: String): CompletableFuture = + retrieve(alertId, AlertRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().alertId(alertId).build(), requestOptions) + + /** @see [retrieve] */ + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + ): CompletableFuture = retrieve(alertId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -34,7 +48,30 @@ interface AlertServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [retrieve] */ + fun retrieve(params: AlertRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve(alertId: String, requestOptions: RequestOptions): CompletableFuture = + retrieve(alertId, AlertRetrieveParams.none(), requestOptions) + /** This endpoint updates the thresholds of an alert. */ + fun update(alertConfigurationId: String, params: AlertUpdateParams): CompletableFuture = + update(alertConfigurationId, params, RequestOptions.none()) + + /** @see [update] */ + fun update( + alertConfigurationId: String, + params: AlertUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [update] */ fun update(params: AlertUpdateParams): CompletableFuture = update(params, RequestOptions.none()) @@ -80,6 +117,20 @@ interface AlertServiceAsync { * `credit_balance_dropped` alerts require a list of thresholds to be provided while * `credit_balance_depleted` and `credit_balance_recovered` alerts do not require thresholds. */ + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + ): CompletableFuture = createForCustomer(customerId, params, RequestOptions.none()) + + /** @see [createForCustomer] */ + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createForCustomer(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createForCustomer] */ fun createForCustomer(params: AlertCreateForCustomerParams): CompletableFuture = createForCustomer(params, RequestOptions.none()) @@ -97,6 +148,24 @@ interface AlertServiceAsync { * `credit_balance_dropped` alerts require a list of thresholds to be provided while * `credit_balance_depleted` and `credit_balance_recovered` alerts do not require thresholds. */ + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + ): CompletableFuture = + createForExternalCustomer(externalCustomerId, params, RequestOptions.none()) + + /** @see [createForExternalCustomer] */ + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createForExternalCustomer( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createForExternalCustomer] */ fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams ): CompletableFuture = createForExternalCustomer(params, RequestOptions.none()) @@ -119,6 +188,24 @@ interface AlertServiceAsync { * per metric that is a part of the subscription. Alerts are triggered based on usage or cost * conditions met during the current billing cycle. */ + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + ): CompletableFuture = + createForSubscription(subscriptionId, params, RequestOptions.none()) + + /** @see [createForSubscription] */ + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createForSubscription( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [createForSubscription] */ fun createForSubscription(params: AlertCreateForSubscriptionParams): CompletableFuture = createForSubscription(params, RequestOptions.none()) @@ -133,8 +220,25 @@ interface AlertServiceAsync { * subscription, you must include the `subscription_id`. The `subscription_id` is not required * for customer or subscription level alerts. */ - fun disable(params: AlertDisableParams): CompletableFuture = - disable(params, RequestOptions.none()) + fun disable(alertConfigurationId: String): CompletableFuture = + disable(alertConfigurationId, AlertDisableParams.none()) + + /** @see [disable] */ + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + disable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [disable] */ + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + ): CompletableFuture = disable(alertConfigurationId, params, RequestOptions.none()) /** @see [disable] */ fun disable( @@ -142,13 +246,41 @@ interface AlertServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [disable] */ + fun disable(params: AlertDisableParams): CompletableFuture = + disable(params, RequestOptions.none()) + + /** @see [disable] */ + fun disable( + alertConfigurationId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + disable(alertConfigurationId, AlertDisableParams.none(), requestOptions) + /** * This endpoint allows you to enable an alert. To enable a plan-level alert for a specific * subscription, you must include the `subscription_id`. The `subscription_id` is not required * for customer or subscription level alerts. */ - fun enable(params: AlertEnableParams): CompletableFuture = - enable(params, RequestOptions.none()) + fun enable(alertConfigurationId: String): CompletableFuture = + enable(alertConfigurationId, AlertEnableParams.none()) + + /** @see [enable] */ + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + enable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [enable] */ + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + ): CompletableFuture = enable(alertConfigurationId, params, RequestOptions.none()) /** @see [enable] */ fun enable( @@ -156,6 +288,17 @@ interface AlertServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [enable] */ + fun enable(params: AlertEnableParams): CompletableFuture = + enable(params, RequestOptions.none()) + + /** @see [enable] */ + fun enable( + alertConfigurationId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + enable(alertConfigurationId, AlertEnableParams.none(), requestOptions) + /** A view of [AlertServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -164,8 +307,25 @@ interface AlertServiceAsync { * [AlertServiceAsync.retrieve]. */ @MustBeClosed - fun retrieve(params: AlertRetrieveParams): CompletableFuture> = - retrieve(params, RequestOptions.none()) + fun retrieve(alertId: String): CompletableFuture> = + retrieve(alertId, AlertRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().alertId(alertId).build(), requestOptions) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + ): CompletableFuture> = + retrieve(alertId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -174,11 +334,44 @@ interface AlertServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [retrieve] */ + @MustBeClosed + fun retrieve(params: AlertRetrieveParams): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + alertId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(alertId, AlertRetrieveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `put /alerts/{alert_configuration_id}`, but is otherwise * the same as [AlertServiceAsync.update]. */ @MustBeClosed + fun update( + alertConfigurationId: String, + params: AlertUpdateParams, + ): CompletableFuture> = + update(alertConfigurationId, params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + alertConfigurationId: String, + params: AlertUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [update] */ + @MustBeClosed fun update(params: AlertUpdateParams): CompletableFuture> = update(params, RequestOptions.none()) @@ -223,6 +416,23 @@ interface AlertServiceAsync { * otherwise the same as [AlertServiceAsync.createForCustomer]. */ @MustBeClosed + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + ): CompletableFuture> = + createForCustomer(customerId, params, RequestOptions.none()) + + /** @see [createForCustomer] */ + @MustBeClosed + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createForCustomer(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createForCustomer] */ + @MustBeClosed fun createForCustomer( params: AlertCreateForCustomerParams ): CompletableFuture> = @@ -241,6 +451,26 @@ interface AlertServiceAsync { * [AlertServiceAsync.createForExternalCustomer]. */ @MustBeClosed + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + ): CompletableFuture> = + createForExternalCustomer(externalCustomerId, params, RequestOptions.none()) + + /** @see [createForExternalCustomer] */ + @MustBeClosed + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createForExternalCustomer( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createForExternalCustomer] */ + @MustBeClosed fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams ): CompletableFuture> = @@ -258,6 +488,26 @@ interface AlertServiceAsync { * otherwise the same as [AlertServiceAsync.createForSubscription]. */ @MustBeClosed + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + ): CompletableFuture> = + createForSubscription(subscriptionId, params, RequestOptions.none()) + + /** @see [createForSubscription] */ + @MustBeClosed + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createForSubscription( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [createForSubscription] */ + @MustBeClosed fun createForSubscription( params: AlertCreateForSubscriptionParams ): CompletableFuture> = @@ -275,8 +525,28 @@ interface AlertServiceAsync { * otherwise the same as [AlertServiceAsync.disable]. */ @MustBeClosed - fun disable(params: AlertDisableParams): CompletableFuture> = - disable(params, RequestOptions.none()) + fun disable(alertConfigurationId: String): CompletableFuture> = + disable(alertConfigurationId, AlertDisableParams.none()) + + /** @see [disable] */ + @MustBeClosed + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + disable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [disable] */ + @MustBeClosed + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + ): CompletableFuture> = + disable(alertConfigurationId, params, RequestOptions.none()) /** @see [disable] */ @MustBeClosed @@ -285,13 +555,46 @@ interface AlertServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [disable] */ + @MustBeClosed + fun disable(params: AlertDisableParams): CompletableFuture> = + disable(params, RequestOptions.none()) + + /** @see [disable] */ + @MustBeClosed + fun disable( + alertConfigurationId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + disable(alertConfigurationId, AlertDisableParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /alerts/{alert_configuration_id}/enable`, but is * otherwise the same as [AlertServiceAsync.enable]. */ @MustBeClosed - fun enable(params: AlertEnableParams): CompletableFuture> = - enable(params, RequestOptions.none()) + fun enable(alertConfigurationId: String): CompletableFuture> = + enable(alertConfigurationId, AlertEnableParams.none()) + + /** @see [enable] */ + @MustBeClosed + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + enable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [enable] */ + @MustBeClosed + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + ): CompletableFuture> = + enable(alertConfigurationId, params, RequestOptions.none()) /** @see [enable] */ @MustBeClosed @@ -299,5 +602,18 @@ interface AlertServiceAsync { params: AlertEnableParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [enable] */ + @MustBeClosed + fun enable(params: AlertEnableParams): CompletableFuture> = + enable(params, RequestOptions.none()) + + /** @see [enable] */ + @MustBeClosed + fun enable( + alertConfigurationId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + enable(alertConfigurationId, AlertEnableParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt index 3a07f60d7..3dcd55db0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -27,6 +28,7 @@ import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class AlertServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AlertServiceAsync { @@ -105,6 +107,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertRetrieveParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertId", params.alertId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -134,6 +139,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertConfigurationId", params.alertConfigurationId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -201,6 +209,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertCreateForCustomerParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -231,6 +242,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertCreateForExternalCustomerParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -261,6 +275,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertCreateForSubscriptionParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -291,6 +308,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertDisableParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertConfigurationId", params.alertConfigurationId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -321,6 +341,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie params: AlertEnableParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertConfigurationId", params.alertConfigurationId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsync.kt index d3cbe42e9..0fceafb78 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsync.kt @@ -66,8 +66,22 @@ interface CouponServiceAsync { * will be hidden from lists of active coupons. Additionally, once a coupon is archived, its * redemption code can be reused for a different coupon. */ - fun archive(params: CouponArchiveParams): CompletableFuture = - archive(params, RequestOptions.none()) + fun archive(couponId: String): CompletableFuture = + archive(couponId, CouponArchiveParams.none()) + + /** @see [archive] */ + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + archive(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [archive] */ + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + ): CompletableFuture = archive(couponId, params, RequestOptions.none()) /** @see [archive] */ fun archive( @@ -75,12 +89,34 @@ interface CouponServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [archive] */ + fun archive(params: CouponArchiveParams): CompletableFuture = + archive(params, RequestOptions.none()) + + /** @see [archive] */ + fun archive(couponId: String, requestOptions: RequestOptions): CompletableFuture = + archive(couponId, CouponArchiveParams.none(), requestOptions) + /** * This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption code, use * the [List coupons](list-coupons) endpoint with the redemption_code parameter. */ - fun fetch(params: CouponFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(couponId: String): CompletableFuture = + fetch(couponId, CouponFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + ): CompletableFuture = fetch(couponId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -88,6 +124,14 @@ interface CouponServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: CouponFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(couponId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(couponId, CouponFetchParams.none(), requestOptions) + /** * A view of [CouponServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -144,8 +188,25 @@ interface CouponServiceAsync { * same as [CouponServiceAsync.archive]. */ @MustBeClosed - fun archive(params: CouponArchiveParams): CompletableFuture> = - archive(params, RequestOptions.none()) + fun archive(couponId: String): CompletableFuture> = + archive(couponId, CouponArchiveParams.none()) + + /** @see [archive] */ + @MustBeClosed + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + archive(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [archive] */ + @MustBeClosed + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + ): CompletableFuture> = + archive(couponId, params, RequestOptions.none()) /** @see [archive] */ @MustBeClosed @@ -154,13 +215,43 @@ interface CouponServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [archive] */ + @MustBeClosed + fun archive(params: CouponArchiveParams): CompletableFuture> = + archive(params, RequestOptions.none()) + + /** @see [archive] */ + @MustBeClosed + fun archive( + couponId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + archive(couponId, CouponArchiveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /coupons/{coupon_id}`, but is otherwise the same as * [CouponServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: CouponFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(couponId: String): CompletableFuture> = + fetch(couponId, CouponFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + ): CompletableFuture> = + fetch(couponId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -168,5 +259,18 @@ interface CouponServiceAsync { params: CouponFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: CouponFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + couponId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(couponId, CouponFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt index 38a83bca3..78f476779 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -25,6 +26,7 @@ import com.withorb.api.models.CouponListParams import com.withorb.api.services.async.coupons.SubscriptionServiceAsync import com.withorb.api.services.async.coupons.SubscriptionServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class CouponServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CouponServiceAsync { @@ -154,6 +156,9 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CouponArchiveParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("couponId", params.couponId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -184,6 +189,9 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CouponFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("couponId", params.couponId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt index dbf8afee7..d3ad060b8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt @@ -55,8 +55,22 @@ interface CreditNoteServiceAsync { * This endpoint is used to fetch a single [`Credit Note`](/invoicing/credit-notes) given an * identifier. */ - fun fetch(params: CreditNoteFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(creditNoteId: String): CompletableFuture = + fetch(creditNoteId, CreditNoteFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().creditNoteId(creditNoteId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + ): CompletableFuture = fetch(creditNoteId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -64,6 +78,14 @@ interface CreditNoteServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: CreditNoteFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(creditNoteId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(creditNoteId, CreditNoteFetchParams.none(), requestOptions) + /** * A view of [CreditNoteServiceAsync] that provides access to raw HTTP responses for each * method. @@ -119,8 +141,25 @@ interface CreditNoteServiceAsync { * the same as [CreditNoteServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: CreditNoteFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(creditNoteId: String): CompletableFuture> = + fetch(creditNoteId, CreditNoteFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().creditNoteId(creditNoteId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + ): CompletableFuture> = + fetch(creditNoteId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -128,5 +167,18 @@ interface CreditNoteServiceAsync { params: CreditNoteFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: CreditNoteFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + creditNoteId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(creditNoteId, CreditNoteFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt index 1c25b2ee0..3320325d4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -22,6 +23,7 @@ import com.withorb.api.models.CreditNoteListPageAsync import com.withorb.api.models.CreditNoteListPageResponse import com.withorb.api.models.CreditNoteListParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CreditNoteServiceAsync { @@ -132,6 +134,9 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: params: CreditNoteFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("creditNoteId", params.creditNoteId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt index 0b1495b1a..629d49733 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt @@ -63,8 +63,22 @@ interface CustomerServiceAsync { * `billing_address`, and `additional_emails` of an existing customer. Other fields on a * customer are currently immutable. */ - fun update(params: CustomerUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(customerId: String): CompletableFuture = + update(customerId, CustomerUpdateParams.none()) + + /** @see [update] */ + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [update] */ + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + ): CompletableFuture = update(customerId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -72,6 +86,14 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: CustomerUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(customerId: String, requestOptions: RequestOptions): CompletableFuture = + update(customerId, CustomerUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all customers for an account. The list of customers is * ordered starting from the most recently created customer. This endpoint follows Orb's @@ -111,8 +133,22 @@ interface CustomerServiceAsync { * * On successful processing, this returns an empty dictionary (`{}`) in the API. */ - fun delete(params: CustomerDeleteParams): CompletableFuture = - delete(params, RequestOptions.none()) + fun delete(customerId: String): CompletableFuture = + delete(customerId, CustomerDeleteParams.none()) + + /** @see [delete] */ + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + delete(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [delete] */ + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + ): CompletableFuture = delete(customerId, params, RequestOptions.none()) /** @see [delete] */ fun delete( @@ -120,6 +156,14 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [delete] */ + fun delete(params: CustomerDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + fun delete(customerId: String, requestOptions: RequestOptions): CompletableFuture = + delete(customerId, CustomerDeleteParams.none(), requestOptions) + /** * This endpoint is used to fetch customer details given an identifier. If the `Customer` is in * the process of being deleted, only the properties `id` and `deleted: true` will be returned. @@ -127,8 +171,22 @@ interface CustomerServiceAsync { * See the [Customer resource](/core-concepts#customer) for a full discussion of the Customer * model. */ - fun fetch(params: CustomerFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(customerId: String): CompletableFuture = + fetch(customerId, CustomerFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + ): CompletableFuture = fetch(customerId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -136,6 +194,14 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: CustomerFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(customerId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(customerId, CustomerFetchParams.none(), requestOptions) + /** * This endpoint is used to fetch customer details given an `external_customer_id` (see * [Customer ID Aliases](/events-and-metrics/customer-aliases)). @@ -143,8 +209,26 @@ interface CustomerServiceAsync { * Note that the resource and semantics of this endpoint exactly mirror * [Get Customer](fetch-customer). */ - fun fetchByExternalId(params: CustomerFetchByExternalIdParams): CompletableFuture = - fetchByExternalId(params, RequestOptions.none()) + fun fetchByExternalId(externalCustomerId: String): CompletableFuture = + fetchByExternalId(externalCustomerId, CustomerFetchByExternalIdParams.none()) + + /** @see [fetchByExternalId] */ + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetchByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [fetchByExternalId] */ + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + ): CompletableFuture = + fetchByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [fetchByExternalId] */ fun fetchByExternalId( @@ -152,6 +236,21 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetchByExternalId] */ + fun fetchByExternalId(params: CustomerFetchByExternalIdParams): CompletableFuture = + fetchByExternalId(params, RequestOptions.none()) + + /** @see [fetchByExternalId] */ + fun fetchByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + fetchByExternalId( + externalCustomerId, + CustomerFetchByExternalIdParams.none(), + requestOptions, + ) + /** * Sync Orb's payment methods for the customer with their gateway. * @@ -160,9 +259,31 @@ interface CustomerServiceAsync { * * **Note**: This functionality is currently only available for Stripe. */ + fun syncPaymentMethodsFromGateway(customerId: String): CompletableFuture = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ) + + /** @see [syncPaymentMethodsFromGateway] */ fun syncPaymentMethodsFromGateway( - params: CustomerSyncPaymentMethodsFromGatewayParams - ): CompletableFuture = syncPaymentMethodsFromGateway(params, RequestOptions.none()) + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + syncPaymentMethodsFromGateway( + params.toBuilder().customerId(customerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway( + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ): CompletableFuture = + syncPaymentMethodsFromGateway(customerId, params, RequestOptions.none()) /** @see [syncPaymentMethodsFromGateway] */ fun syncPaymentMethodsFromGateway( @@ -170,6 +291,22 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway( + params: CustomerSyncPaymentMethodsFromGatewayParams + ): CompletableFuture = syncPaymentMethodsFromGateway(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions, + ) + /** * Sync Orb's payment methods for the customer with their gateway. * @@ -179,9 +316,36 @@ interface CustomerServiceAsync { * **Note**: This functionality is currently only available for Stripe. */ fun syncPaymentMethodsFromGatewayByExternalCustomerId( - params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + externalCustomerId: String ): CompletableFuture = - syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + params, + RequestOptions.none(), + ) /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ fun syncPaymentMethodsFromGatewayByExternalCustomerId( @@ -189,13 +353,44 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions, + ) + /** * This endpoint is used to update customer details given an `external_customer_id` (see * [Customer ID Aliases](/events-and-metrics/customer-aliases)). Note that the resource and * semantics of this endpoint exactly mirror [Update Customer](update-customer). */ - fun updateByExternalId(params: CustomerUpdateByExternalIdParams): CompletableFuture = - updateByExternalId(params, RequestOptions.none()) + fun updateByExternalId(id: String): CompletableFuture = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none()) + + /** @see [updateByExternalId] */ + fun updateByExternalId( + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + updateByExternalId(params.toBuilder().id(id).build(), requestOptions) + + /** @see [updateByExternalId] */ + fun updateByExternalId( + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + ): CompletableFuture = updateByExternalId(id, params, RequestOptions.none()) /** @see [updateByExternalId] */ fun updateByExternalId( @@ -203,6 +398,17 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [updateByExternalId] */ + fun updateByExternalId(params: CustomerUpdateByExternalIdParams): CompletableFuture = + updateByExternalId(params, RequestOptions.none()) + + /** @see [updateByExternalId] */ + fun updateByExternalId( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none(), requestOptions) + /** * A view of [CustomerServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -234,8 +440,25 @@ interface CustomerServiceAsync { * as [CustomerServiceAsync.update]. */ @MustBeClosed - fun update(params: CustomerUpdateParams): CompletableFuture> = - update(params, RequestOptions.none()) + fun update(customerId: String): CompletableFuture> = + update(customerId, CustomerUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + ): CompletableFuture> = + update(customerId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -244,6 +467,19 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update(params: CustomerUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(customerId, CustomerUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /customers`, but is otherwise the same as * [CustomerServiceAsync.list]. @@ -278,8 +514,24 @@ interface CustomerServiceAsync { * same as [CustomerServiceAsync.delete]. */ @MustBeClosed - fun delete(params: CustomerDeleteParams): CompletableFuture = - delete(params, RequestOptions.none()) + fun delete(customerId: String): CompletableFuture = + delete(customerId, CustomerDeleteParams.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + delete(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [delete] */ + @MustBeClosed + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + ): CompletableFuture = delete(customerId, params, RequestOptions.none()) /** @see [delete] */ @MustBeClosed @@ -288,13 +540,43 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [delete] */ + @MustBeClosed + fun delete(params: CustomerDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + delete(customerId, CustomerDeleteParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /customers/{customer_id}`, but is otherwise the same * as [CustomerServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: CustomerFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(customerId: String): CompletableFuture> = + fetch(customerId, CustomerFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + ): CompletableFuture> = + fetch(customerId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -303,6 +585,19 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: CustomerFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(customerId, CustomerFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get * /customers/external_customer_id/{external_customer_id}`, but is otherwise the same as @@ -310,9 +605,29 @@ interface CustomerServiceAsync { */ @MustBeClosed fun fetchByExternalId( - params: CustomerFetchByExternalIdParams + externalCustomerId: String ): CompletableFuture> = - fetchByExternalId(params, RequestOptions.none()) + fetchByExternalId(externalCustomerId, CustomerFetchByExternalIdParams.none()) + + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetchByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + ): CompletableFuture> = + fetchByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [fetchByExternalId] */ @MustBeClosed @@ -321,16 +636,58 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + params: CustomerFetchByExternalIdParams + ): CompletableFuture> = + fetchByExternalId(params, RequestOptions.none()) + + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetchByExternalId( + externalCustomerId, + CustomerFetchByExternalIdParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /customers/{customer_id}/sync_payment_methods_from_gateway`, but is otherwise the same as * [CustomerServiceAsync.syncPaymentMethodsFromGateway]. */ @MustBeClosed + fun syncPaymentMethodsFromGateway(customerId: String): CompletableFuture = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ) + + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed fun syncPaymentMethodsFromGateway( - params: CustomerSyncPaymentMethodsFromGatewayParams + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture = - syncPaymentMethodsFromGateway(params, RequestOptions.none()) + syncPaymentMethodsFromGateway( + params.toBuilder().customerId(customerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed + fun syncPaymentMethodsFromGateway( + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ): CompletableFuture = + syncPaymentMethodsFromGateway(customerId, params, RequestOptions.none()) /** @see [syncPaymentMethodsFromGateway] */ @MustBeClosed @@ -339,6 +696,25 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed + fun syncPaymentMethodsFromGateway( + params: CustomerSyncPaymentMethodsFromGatewayParams + ): CompletableFuture = + syncPaymentMethodsFromGateway(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed + fun syncPaymentMethodsFromGateway( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway`, @@ -347,9 +723,38 @@ interface CustomerServiceAsync { */ @MustBeClosed fun syncPaymentMethodsFromGatewayByExternalCustomerId( - params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + externalCustomerId: String ): CompletableFuture = - syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + params, + RequestOptions.none(), + ) /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ @MustBeClosed @@ -358,16 +763,50 @@ interface CustomerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `put * /customers/external_customer_id/{external_customer_id}`, but is otherwise the same as * [CustomerServiceAsync.updateByExternalId]. */ @MustBeClosed + fun updateByExternalId(id: String): CompletableFuture> = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none()) + + /** @see [updateByExternalId] */ + @MustBeClosed fun updateByExternalId( - params: CustomerUpdateByExternalIdParams + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> = - updateByExternalId(params, RequestOptions.none()) + updateByExternalId(params.toBuilder().id(id).build(), requestOptions) + + /** @see [updateByExternalId] */ + @MustBeClosed + fun updateByExternalId( + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + ): CompletableFuture> = + updateByExternalId(id, params, RequestOptions.none()) /** @see [updateByExternalId] */ @MustBeClosed @@ -375,5 +814,20 @@ interface CustomerServiceAsync { params: CustomerUpdateByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [updateByExternalId] */ + @MustBeClosed + fun updateByExternalId( + params: CustomerUpdateByExternalIdParams + ): CompletableFuture> = + updateByExternalId(params, RequestOptions.none()) + + /** @see [updateByExternalId] */ + @MustBeClosed + fun updateByExternalId( + id: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt index 7ed7766fb..23e5bcd8b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.emptyHandler import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler @@ -36,6 +37,7 @@ import com.withorb.api.services.async.customers.CostServiceAsyncImpl import com.withorb.api.services.async.customers.CreditServiceAsync import com.withorb.api.services.async.customers.CreditServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class CustomerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CustomerServiceAsync { @@ -187,6 +189,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -253,6 +258,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerDeleteParams, requestOptions: RequestOptions, ): CompletableFuture { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.DELETE) @@ -275,6 +283,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -304,6 +315,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerFetchByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -333,6 +347,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerSyncPaymentMethodsFromGatewayParams, requestOptions: RequestOptions, ): CompletableFuture { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -361,6 +378,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, requestOptions: RequestOptions, ): CompletableFuture { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -392,6 +412,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerUpdateByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsync.kt index d50338f59..b9f463fc9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsync.kt @@ -42,9 +42,26 @@ interface DimensionalPriceGroupServiceAsync { ): CompletableFuture /** Fetch dimensional price group */ + fun retrieve(dimensionalPriceGroupId: String): CompletableFuture = + retrieve(dimensionalPriceGroupId, DimensionalPriceGroupRetrieveParams.none()) + + /** @see [retrieve] */ fun retrieve( - params: DimensionalPriceGroupRetrieveParams - ): CompletableFuture = retrieve(params, RequestOptions.none()) + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve( + params.toBuilder().dimensionalPriceGroupId(dimensionalPriceGroupId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + fun retrieve( + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams.none(), + ): CompletableFuture = + retrieve(dimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -52,6 +69,22 @@ interface DimensionalPriceGroupServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [retrieve] */ + fun retrieve( + params: DimensionalPriceGroupRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + dimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve( + dimensionalPriceGroupId, + DimensionalPriceGroupRetrieveParams.none(), + requestOptions, + ) + /** List dimensional price groups */ fun list(): CompletableFuture = list(DimensionalPriceGroupListParams.none()) @@ -106,9 +139,30 @@ interface DimensionalPriceGroupServiceAsync { */ @MustBeClosed fun retrieve( - params: DimensionalPriceGroupRetrieveParams + dimensionalPriceGroupId: String ): CompletableFuture> = - retrieve(params, RequestOptions.none()) + retrieve(dimensionalPriceGroupId, DimensionalPriceGroupRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = + DimensionalPriceGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve( + params.toBuilder().dimensionalPriceGroupId(dimensionalPriceGroupId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams.none(), + ): CompletableFuture> = + retrieve(dimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -117,6 +171,25 @@ interface DimensionalPriceGroupServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: DimensionalPriceGroupRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + dimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve( + dimensionalPriceGroupId, + DimensionalPriceGroupRetrieveParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `get /dimensional_price_groups`, but is otherwise the * same as [DimensionalPriceGroupServiceAsync.list]. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt index b65239766..1e5a44e0a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -24,6 +25,7 @@ import com.withorb.api.models.DimensionalPriceGroups import com.withorb.api.services.async.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceAsync import com.withorb.api.services.async.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class DimensionalPriceGroupServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : DimensionalPriceGroupServiceAsync { @@ -117,6 +119,9 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric params: DimensionalPriceGroupRetrieveParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("dimensionalPriceGroupId", params.dimensionalPriceGroupId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsync.kt index 8d64fda3a..dee666866 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsync.kt @@ -69,6 +69,18 @@ interface EventServiceAsync { * period. For higher volume updates, consider using the [event backfill](create-backfill) * endpoint. */ + fun update(eventId: String, params: EventUpdateParams): CompletableFuture = + update(eventId, params, RequestOptions.none()) + + /** @see [update] */ + fun update( + eventId: String, + params: EventUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [update] */ fun update(params: EventUpdateParams): CompletableFuture = update(params, RequestOptions.none()) @@ -114,8 +126,22 @@ interface EventServiceAsync { * period. For higher volume updates, consider using the [event backfill](create-backfill) * endpoint. */ - fun deprecate(params: EventDeprecateParams): CompletableFuture = - deprecate(params, RequestOptions.none()) + fun deprecate(eventId: String): CompletableFuture = + deprecate(eventId, EventDeprecateParams.none()) + + /** @see [deprecate] */ + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + deprecate(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [deprecate] */ + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + ): CompletableFuture = deprecate(eventId, params, RequestOptions.none()) /** @see [deprecate] */ fun deprecate( @@ -123,6 +149,17 @@ interface EventServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [deprecate] */ + fun deprecate(params: EventDeprecateParams): CompletableFuture = + deprecate(params, RequestOptions.none()) + + /** @see [deprecate] */ + fun deprecate( + eventId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + deprecate(eventId, EventDeprecateParams.none(), requestOptions) + /** * Orb's event ingestion model and API is designed around two core principles: * 1. **Data fidelity**: The accuracy of your billing model depends on a robust foundation of @@ -360,6 +397,23 @@ interface EventServiceAsync { * [EventServiceAsync.update]. */ @MustBeClosed + fun update( + eventId: String, + params: EventUpdateParams, + ): CompletableFuture> = + update(eventId, params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + eventId: String, + params: EventUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed fun update( params: EventUpdateParams ): CompletableFuture> = @@ -377,10 +431,25 @@ interface EventServiceAsync { * same as [EventServiceAsync.deprecate]. */ @MustBeClosed + fun deprecate(eventId: String): CompletableFuture> = + deprecate(eventId, EventDeprecateParams.none()) + + /** @see [deprecate] */ + @MustBeClosed fun deprecate( - params: EventDeprecateParams + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> = - deprecate(params, RequestOptions.none()) + deprecate(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [deprecate] */ + @MustBeClosed + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + ): CompletableFuture> = + deprecate(eventId, params, RequestOptions.none()) /** @see [deprecate] */ @MustBeClosed @@ -389,6 +458,21 @@ interface EventServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [deprecate] */ + @MustBeClosed + fun deprecate( + params: EventDeprecateParams + ): CompletableFuture> = + deprecate(params, RequestOptions.none()) + + /** @see [deprecate] */ + @MustBeClosed + fun deprecate( + eventId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + deprecate(eventId, EventDeprecateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /ingest`, but is otherwise the same as * [EventServiceAsync.ingest]. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt index 02d350b09..845755345 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -28,6 +29,7 @@ import com.withorb.api.services.async.events.BackfillServiceAsyncImpl import com.withorb.api.services.async.events.VolumeServiceAsync import com.withorb.api.services.async.events.VolumeServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class EventServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : EventServiceAsync { @@ -99,6 +101,9 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie params: EventUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("eventId", params.eventId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -130,6 +135,9 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie params: EventDeprecateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("eventId", params.eventId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt index 46eeeaa56..175dc7e64 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt @@ -42,8 +42,22 @@ interface InvoiceServiceAsync { * * `metadata` can be modified regardless of invoice state. */ - fun update(params: InvoiceUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(invoiceId: String): CompletableFuture = + update(invoiceId, InvoiceUpdateParams.none()) + + /** @see [update] */ + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [update] */ + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + ): CompletableFuture = update(invoiceId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -51,6 +65,14 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: InvoiceUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(invoiceId: String, requestOptions: RequestOptions): CompletableFuture = + update(invoiceId, InvoiceUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all [`Invoice`](/core-concepts#invoice)s for an account in a * list format. @@ -85,8 +107,22 @@ interface InvoiceServiceAsync { /** * This endpoint is used to fetch an [`Invoice`](/core-concepts#invoice) given an identifier. */ - fun fetch(params: InvoiceFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(invoiceId: String): CompletableFuture = + fetch(invoiceId, InvoiceFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + ): CompletableFuture = fetch(invoiceId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -94,6 +130,14 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: InvoiceFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(invoiceId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(invoiceId, InvoiceFetchParams.none(), requestOptions) + /** * This endpoint can be used to fetch the upcoming [invoice](/core-concepts#invoice) for the * current billing period given a subscription. @@ -116,8 +160,22 @@ interface InvoiceServiceAsync { * could be customer-visible (e.g. sending emails, auto-collecting payment, syncing the invoice * to external providers, etc). */ - fun issue(params: InvoiceIssueParams): CompletableFuture = - issue(params, RequestOptions.none()) + fun issue(invoiceId: String): CompletableFuture = + issue(invoiceId, InvoiceIssueParams.none()) + + /** @see [issue] */ + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + issue(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [issue] */ + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + ): CompletableFuture = issue(invoiceId, params, RequestOptions.none()) /** @see [issue] */ fun issue( @@ -125,10 +183,30 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [issue] */ + fun issue(params: InvoiceIssueParams): CompletableFuture = + issue(params, RequestOptions.none()) + + /** @see [issue] */ + fun issue(invoiceId: String, requestOptions: RequestOptions): CompletableFuture = + issue(invoiceId, InvoiceIssueParams.none(), requestOptions) + /** * This endpoint allows an invoice's status to be set the `paid` status. This can only be done * to invoices that are in the `issued` status. */ + fun markPaid(invoiceId: String, params: InvoiceMarkPaidParams): CompletableFuture = + markPaid(invoiceId, params, RequestOptions.none()) + + /** @see [markPaid] */ + fun markPaid( + invoiceId: String, + params: InvoiceMarkPaidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + markPaid(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [markPaid] */ fun markPaid(params: InvoiceMarkPaidParams): CompletableFuture = markPaid(params, RequestOptions.none()) @@ -142,8 +220,21 @@ interface InvoiceServiceAsync { * This endpoint collects payment for an invoice using the customer's default payment method. * This action can only be taken on invoices with status "issued". */ - fun pay(params: InvoicePayParams): CompletableFuture = - pay(params, RequestOptions.none()) + fun pay(invoiceId: String): CompletableFuture = pay(invoiceId, InvoicePayParams.none()) + + /** @see [pay] */ + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + pay(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [pay] */ + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + ): CompletableFuture = pay(invoiceId, params, RequestOptions.none()) /** @see [pay] */ fun pay( @@ -151,6 +242,14 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [pay] */ + fun pay(params: InvoicePayParams): CompletableFuture = + pay(params, RequestOptions.none()) + + /** @see [pay] */ + fun pay(invoiceId: String, requestOptions: RequestOptions): CompletableFuture = + pay(invoiceId, InvoicePayParams.none(), requestOptions) + /** * This endpoint allows an invoice's status to be set the `void` status. This can only be done * to invoices that are in the `issued` status. @@ -163,8 +262,22 @@ interface InvoiceServiceAsync { * credit block will be voided. If the invoice was created due to a top-up, the top-up will be * disabled. */ - fun voidInvoice(params: InvoiceVoidInvoiceParams): CompletableFuture = - voidInvoice(params, RequestOptions.none()) + fun voidInvoice(invoiceId: String): CompletableFuture = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none()) + + /** @see [voidInvoice] */ + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + voidInvoice(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [voidInvoice] */ + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + ): CompletableFuture = voidInvoice(invoiceId, params, RequestOptions.none()) /** @see [voidInvoice] */ fun voidInvoice( @@ -172,6 +285,14 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [voidInvoice] */ + fun voidInvoice(params: InvoiceVoidInvoiceParams): CompletableFuture = + voidInvoice(params, RequestOptions.none()) + + /** @see [voidInvoice] */ + fun voidInvoice(invoiceId: String, requestOptions: RequestOptions): CompletableFuture = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none(), requestOptions) + /** * A view of [InvoiceServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -197,8 +318,25 @@ interface InvoiceServiceAsync { * as [InvoiceServiceAsync.update]. */ @MustBeClosed - fun update(params: InvoiceUpdateParams): CompletableFuture> = - update(params, RequestOptions.none()) + fun update(invoiceId: String): CompletableFuture> = + update(invoiceId, InvoiceUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + ): CompletableFuture> = + update(invoiceId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -207,6 +345,19 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update(params: InvoiceUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + invoiceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(invoiceId, InvoiceUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /invoices`, but is otherwise the same as * [InvoiceServiceAsync.list]. @@ -241,8 +392,25 @@ interface InvoiceServiceAsync { * as [InvoiceServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: InvoiceFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(invoiceId: String): CompletableFuture> = + fetch(invoiceId, InvoiceFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + ): CompletableFuture> = + fetch(invoiceId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -251,6 +419,19 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: InvoiceFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + invoiceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(invoiceId, InvoiceFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /invoices/upcoming`, but is otherwise the same as * [InvoiceServiceAsync.fetchUpcoming]. @@ -273,8 +454,25 @@ interface InvoiceServiceAsync { * same as [InvoiceServiceAsync.issue]. */ @MustBeClosed - fun issue(params: InvoiceIssueParams): CompletableFuture> = - issue(params, RequestOptions.none()) + fun issue(invoiceId: String): CompletableFuture> = + issue(invoiceId, InvoiceIssueParams.none()) + + /** @see [issue] */ + @MustBeClosed + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + issue(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [issue] */ + @MustBeClosed + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + ): CompletableFuture> = + issue(invoiceId, params, RequestOptions.none()) /** @see [issue] */ @MustBeClosed @@ -283,11 +481,41 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [issue] */ + @MustBeClosed + fun issue(params: InvoiceIssueParams): CompletableFuture> = + issue(params, RequestOptions.none()) + + /** @see [issue] */ + @MustBeClosed + fun issue( + invoiceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + issue(invoiceId, InvoiceIssueParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /invoices/{invoice_id}/mark_paid`, but is otherwise * the same as [InvoiceServiceAsync.markPaid]. */ @MustBeClosed + fun markPaid( + invoiceId: String, + params: InvoiceMarkPaidParams, + ): CompletableFuture> = + markPaid(invoiceId, params, RequestOptions.none()) + + /** @see [markPaid] */ + @MustBeClosed + fun markPaid( + invoiceId: String, + params: InvoiceMarkPaidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + markPaid(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [markPaid] */ + @MustBeClosed fun markPaid(params: InvoiceMarkPaidParams): CompletableFuture> = markPaid(params, RequestOptions.none()) @@ -303,8 +531,25 @@ interface InvoiceServiceAsync { * same as [InvoiceServiceAsync.pay]. */ @MustBeClosed - fun pay(params: InvoicePayParams): CompletableFuture> = - pay(params, RequestOptions.none()) + fun pay(invoiceId: String): CompletableFuture> = + pay(invoiceId, InvoicePayParams.none()) + + /** @see [pay] */ + @MustBeClosed + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + pay(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [pay] */ + @MustBeClosed + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + ): CompletableFuture> = + pay(invoiceId, params, RequestOptions.none()) /** @see [pay] */ @MustBeClosed @@ -313,14 +558,43 @@ interface InvoiceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [pay] */ + @MustBeClosed + fun pay(params: InvoicePayParams): CompletableFuture> = + pay(params, RequestOptions.none()) + + /** @see [pay] */ + @MustBeClosed + fun pay( + invoiceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + pay(invoiceId, InvoicePayParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /invoices/{invoice_id}/void`, but is otherwise the * same as [InvoiceServiceAsync.voidInvoice]. */ @MustBeClosed + fun voidInvoice(invoiceId: String): CompletableFuture> = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none()) + + /** @see [voidInvoice] */ + @MustBeClosed fun voidInvoice( - params: InvoiceVoidInvoiceParams - ): CompletableFuture> = voidInvoice(params, RequestOptions.none()) + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + voidInvoice(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + ): CompletableFuture> = + voidInvoice(invoiceId, params, RequestOptions.none()) /** @see [voidInvoice] */ @MustBeClosed @@ -328,5 +602,19 @@ interface InvoiceServiceAsync { params: InvoiceVoidInvoiceParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice( + params: InvoiceVoidInvoiceParams + ): CompletableFuture> = voidInvoice(params, RequestOptions.none()) + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice( + invoiceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt index e63e0397c..2a7720037 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -29,6 +30,7 @@ import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : InvoiceServiceAsync { @@ -144,6 +146,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl params: InvoiceUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -211,6 +216,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl params: InvoiceFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -270,6 +278,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl params: InvoiceIssueParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -300,6 +311,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl params: InvoiceMarkPaidParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -330,6 +344,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl params: InvoicePayParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -360,6 +377,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl params: InvoiceVoidInvoiceParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsync.kt index 2cb003e24..e39208eb0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsync.kt @@ -31,8 +31,20 @@ interface ItemServiceAsync { ): CompletableFuture /** This endpoint can be used to update properties on the Item. */ - fun update(params: ItemUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(itemId: String): CompletableFuture = update(itemId, ItemUpdateParams.none()) + + /** @see [update] */ + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = update(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [update] */ + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + ): CompletableFuture = update(itemId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -40,6 +52,14 @@ interface ItemServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: ItemUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(itemId: String, requestOptions: RequestOptions): CompletableFuture = + update(itemId, ItemUpdateParams.none(), requestOptions) + /** This endpoint returns a list of all Items, ordered in descending order by creation time. */ fun list(): CompletableFuture = list(ItemListParams.none()) @@ -58,8 +78,20 @@ interface ItemServiceAsync { list(ItemListParams.none(), requestOptions) /** This endpoint returns an item identified by its item_id. */ - fun fetch(params: ItemFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(itemId: String): CompletableFuture = fetch(itemId, ItemFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = fetch(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + ): CompletableFuture = fetch(itemId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -67,6 +99,14 @@ interface ItemServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: ItemFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(itemId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(itemId, ItemFetchParams.none(), requestOptions) + /** A view of [ItemServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -90,8 +130,24 @@ interface ItemServiceAsync { * [ItemServiceAsync.update]. */ @MustBeClosed - fun update(params: ItemUpdateParams): CompletableFuture> = - update(params, RequestOptions.none()) + fun update(itemId: String): CompletableFuture> = + update(itemId, ItemUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + ): CompletableFuture> = update(itemId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -100,6 +156,19 @@ interface ItemServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update(params: ItemUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + itemId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(itemId, ItemUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /items`, but is otherwise the same as * [ItemServiceAsync.list]. @@ -134,8 +203,24 @@ interface ItemServiceAsync { * [ItemServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: ItemFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(itemId: String): CompletableFuture> = + fetch(itemId, ItemFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + ): CompletableFuture> = fetch(itemId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -143,5 +228,18 @@ interface ItemServiceAsync { params: ItemFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: ItemFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + itemId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(itemId, ItemFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt index 3bca007f3..e814229dd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -23,6 +24,7 @@ import com.withorb.api.models.ItemListPageResponse import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class ItemServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ItemServiceAsync { @@ -103,6 +105,9 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien params: ItemUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("itemId", params.itemId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -170,6 +175,9 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien params: ItemFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("itemId", params.itemId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsync.kt index 554e58cec..e865ac455 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsync.kt @@ -38,8 +38,22 @@ interface MetricServiceAsync { * This endpoint allows you to update the `metadata` property on a metric. If you pass `null` * for the metadata value, it will clear any existing metadata for that invoice. */ - fun update(params: MetricUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(metricId: String): CompletableFuture = + update(metricId, MetricUpdateParams.none()) + + /** @see [update] */ + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [update] */ + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + ): CompletableFuture = update(metricId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -47,6 +61,17 @@ interface MetricServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: MetricUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + metricId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + update(metricId, MetricUpdateParams.none(), requestOptions) + /** * This endpoint is used to fetch [metric](/core-concepts##metric) details given a metric * identifier. It returns information about the metrics including its name, description, and @@ -73,8 +98,22 @@ interface MetricServiceAsync { * This endpoint is used to list [metrics](/core-concepts#metric). It returns information about * the metrics including its name, description, and item. */ - fun fetch(params: MetricFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(metricId: String): CompletableFuture = + fetch(metricId, MetricFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + ): CompletableFuture = fetch(metricId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -82,6 +121,14 @@ interface MetricServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: MetricFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(metricId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(metricId, MetricFetchParams.none(), requestOptions) + /** * A view of [MetricServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -107,8 +154,25 @@ interface MetricServiceAsync { * [MetricServiceAsync.update]. */ @MustBeClosed - fun update(params: MetricUpdateParams): CompletableFuture> = - update(params, RequestOptions.none()) + fun update(metricId: String): CompletableFuture> = + update(metricId, MetricUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + ): CompletableFuture> = + update(metricId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -117,6 +181,19 @@ interface MetricServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update(params: MetricUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + metricId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(metricId, MetricUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /metrics`, but is otherwise the same as * [MetricServiceAsync.list]. @@ -151,8 +228,25 @@ interface MetricServiceAsync { * [MetricServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: MetricFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(metricId: String): CompletableFuture> = + fetch(metricId, MetricFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + ): CompletableFuture> = + fetch(metricId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -160,5 +254,18 @@ interface MetricServiceAsync { params: MetricFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: MetricFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + metricId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(metricId, MetricFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt index 7fcfab11f..f7e1aa1b3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -23,6 +24,7 @@ import com.withorb.api.models.MetricListPageResponse import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class MetricServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : MetricServiceAsync { @@ -103,6 +105,9 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli params: MetricUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("metricId", params.metricId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -170,6 +175,9 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli params: MetricFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("metricId", params.metricId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsync.kt index 28590f41e..ba6eeda3e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsync.kt @@ -39,8 +39,20 @@ interface PlanServiceAsync { * * Other fields on a customer are currently immutable. */ - fun update(params: PlanUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(planId: String): CompletableFuture = update(planId, PlanUpdateParams.none()) + + /** @see [update] */ + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = update(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [update] */ + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + ): CompletableFuture = update(planId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -48,6 +60,14 @@ interface PlanServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: PlanUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(planId: String, requestOptions: RequestOptions): CompletableFuture = + update(planId, PlanUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all [plans](/core-concepts#plan-and-price) for an account in * a list format. The list of plans is ordered starting from the most recently created plan. The @@ -88,8 +108,20 @@ interface PlanServiceAsync { * Orb supports plan phases, also known as contract ramps. For plans with phases, the serialized * prices refer to all prices across all phases. */ - fun fetch(params: PlanFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(planId: String): CompletableFuture = fetch(planId, PlanFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = fetch(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + ): CompletableFuture = fetch(planId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -97,6 +129,14 @@ interface PlanServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: PlanFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(planId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(planId, PlanFetchParams.none(), requestOptions) + /** A view of [PlanServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -122,8 +162,24 @@ interface PlanServiceAsync { * [PlanServiceAsync.update]. */ @MustBeClosed - fun update(params: PlanUpdateParams): CompletableFuture> = - update(params, RequestOptions.none()) + fun update(planId: String): CompletableFuture> = + update(planId, PlanUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + ): CompletableFuture> = update(planId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -132,6 +188,19 @@ interface PlanServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update(params: PlanUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + planId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(planId, PlanUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /plans`, but is otherwise the same as * [PlanServiceAsync.list]. @@ -166,8 +235,24 @@ interface PlanServiceAsync { * [PlanServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: PlanFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(planId: String): CompletableFuture> = + fetch(planId, PlanFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + ): CompletableFuture> = fetch(planId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -175,5 +260,18 @@ interface PlanServiceAsync { params: PlanFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PlanFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + planId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(planId, PlanFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt index 6ed6bd374..535998006 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -25,6 +26,7 @@ import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsync import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class PlanServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PlanServiceAsync { @@ -117,6 +119,9 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien params: PlanUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("planId", params.planId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -184,6 +189,9 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien params: PlanFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("planId", params.planId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsync.kt index ae0f5ebbe..75f167ea9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsync.kt @@ -50,8 +50,22 @@ interface PriceServiceAsync { * This endpoint allows you to update the `metadata` property on a price. If you pass null for * the metadata value, it will clear any existing metadata for that price. */ - fun update(params: PriceUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(priceId: String): CompletableFuture = + update(priceId, PriceUpdateParams.none()) + + /** @see [update] */ + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [update] */ + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + ): CompletableFuture = update(priceId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -59,6 +73,14 @@ interface PriceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: PriceUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(priceId: String, requestOptions: RequestOptions): CompletableFuture = + update(priceId, PriceUpdateParams.none(), requestOptions) + /** * This endpoint is used to list all add-on prices created using the * [price creation endpoint](/api-reference/price/create-price). @@ -99,6 +121,20 @@ interface PriceServiceAsync { * the results must be no greater than 1000. Note that this is a POST endpoint rather than a GET * endpoint because it employs a JSON body rather than query parameters. */ + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + ): CompletableFuture = evaluate(priceId, params, RequestOptions.none()) + + /** @see [evaluate] */ + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + evaluate(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [evaluate] */ fun evaluate(params: PriceEvaluateParams): CompletableFuture = evaluate(params, RequestOptions.none()) @@ -109,8 +145,20 @@ interface PriceServiceAsync { ): CompletableFuture /** This endpoint returns a price given an identifier. */ - fun fetch(params: PriceFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(priceId: String): CompletableFuture = fetch(priceId, PriceFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = fetch(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + ): CompletableFuture = fetch(priceId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -118,6 +166,14 @@ interface PriceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: PriceFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(priceId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(priceId, PriceFetchParams.none(), requestOptions) + /** A view of [PriceServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -143,8 +199,25 @@ interface PriceServiceAsync { * [PriceServiceAsync.update]. */ @MustBeClosed - fun update(params: PriceUpdateParams): CompletableFuture> = - update(params, RequestOptions.none()) + fun update(priceId: String): CompletableFuture> = + update(priceId, PriceUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + ): CompletableFuture> = + update(priceId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -153,6 +226,19 @@ interface PriceServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update(params: PriceUpdateParams): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + priceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(priceId, PriceUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /prices`, but is otherwise the same as * [PriceServiceAsync.list]. @@ -187,6 +273,23 @@ interface PriceServiceAsync { * same as [PriceServiceAsync.evaluate]. */ @MustBeClosed + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + ): CompletableFuture> = + evaluate(priceId, params, RequestOptions.none()) + + /** @see [evaluate] */ + @MustBeClosed + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + evaluate(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [evaluate] */ + @MustBeClosed fun evaluate( params: PriceEvaluateParams ): CompletableFuture> = @@ -204,8 +307,24 @@ interface PriceServiceAsync { * [PriceServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: PriceFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(priceId: String): CompletableFuture> = + fetch(priceId, PriceFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + ): CompletableFuture> = fetch(priceId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -213,5 +332,18 @@ interface PriceServiceAsync { params: PriceFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PriceFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + priceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(priceId, PriceFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt index 0e1e32a6f..8f9bbc360 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -27,6 +28,7 @@ import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsync import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class PriceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PriceServiceAsync { @@ -127,6 +129,9 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie params: PriceUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("priceId", params.priceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -195,6 +200,9 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie params: PriceEvaluateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("priceId", params.priceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -225,6 +233,9 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie params: PriceFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("priceId", params.priceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt index 99380e5bb..40fcbfbbc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt @@ -31,9 +31,27 @@ interface SubscriptionChangeServiceAsync { * response. */ fun retrieve( - params: SubscriptionChangeRetrieveParams + subscriptionChangeId: String ): CompletableFuture = - retrieve(params, RequestOptions.none()) + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + ): CompletableFuture = + retrieve(subscriptionChangeId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -41,14 +59,41 @@ interface SubscriptionChangeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [retrieve] */ + fun retrieve( + params: SubscriptionChangeRetrieveParams + ): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none(), requestOptions) + /** * Apply a subscription change to perform the intended action. If a positive amount is passed * with a request to this endpoint, any eligible invoices that were created will be issued * immediately if they only contain in-advance fees. */ + fun apply(subscriptionChangeId: String): CompletableFuture = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none()) + + /** @see [apply] */ fun apply( - params: SubscriptionChangeApplyParams - ): CompletableFuture = apply(params, RequestOptions.none()) + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + apply(params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), requestOptions) + + /** @see [apply] */ + fun apply( + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + ): CompletableFuture = + apply(subscriptionChangeId, params, RequestOptions.none()) /** @see [apply] */ fun apply( @@ -56,14 +101,43 @@ interface SubscriptionChangeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [apply] */ + fun apply( + params: SubscriptionChangeApplyParams + ): CompletableFuture = apply(params, RequestOptions.none()) + + /** @see [apply] */ + fun apply( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none(), requestOptions) + /** * Cancel a subscription change. The change can no longer be applied. A subscription can only * have one "pending" change at a time - use this endpoint to cancel an existing change before * creating a new one. */ + fun cancel(subscriptionChangeId: String): CompletableFuture = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none()) + + /** @see [cancel] */ fun cancel( - params: SubscriptionChangeCancelParams - ): CompletableFuture = cancel(params, RequestOptions.none()) + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + cancel( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [cancel] */ + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + ): CompletableFuture = + cancel(subscriptionChangeId, params, RequestOptions.none()) /** @see [cancel] */ fun cancel( @@ -71,6 +145,18 @@ interface SubscriptionChangeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [cancel] */ + fun cancel( + params: SubscriptionChangeCancelParams + ): CompletableFuture = cancel(params, RequestOptions.none()) + + /** @see [cancel] */ + fun cancel( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none(), requestOptions) + /** * A view of [SubscriptionChangeServiceAsync] that provides access to raw HTTP responses for * each method. @@ -83,9 +169,29 @@ interface SubscriptionChangeServiceAsync { */ @MustBeClosed fun retrieve( - params: SubscriptionChangeRetrieveParams + subscriptionChangeId: String ): CompletableFuture> = - retrieve(params, RequestOptions.none()) + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + ): CompletableFuture> = + retrieve(subscriptionChangeId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -94,6 +200,21 @@ interface SubscriptionChangeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: SubscriptionChangeRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscription_changes/{subscription_change_id}/apply`, but is otherwise the same as @@ -101,9 +222,29 @@ interface SubscriptionChangeServiceAsync { */ @MustBeClosed fun apply( - params: SubscriptionChangeApplyParams + subscriptionChangeId: String ): CompletableFuture> = - apply(params, RequestOptions.none()) + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none()) + + /** @see [apply] */ + @MustBeClosed + fun apply( + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + apply( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [apply] */ + @MustBeClosed + fun apply( + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + ): CompletableFuture> = + apply(subscriptionChangeId, params, RequestOptions.none()) /** @see [apply] */ @MustBeClosed @@ -112,6 +253,21 @@ interface SubscriptionChangeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [apply] */ + @MustBeClosed + fun apply( + params: SubscriptionChangeApplyParams + ): CompletableFuture> = + apply(params, RequestOptions.none()) + + /** @see [apply] */ + @MustBeClosed + fun apply( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscription_changes/{subscription_change_id}/cancel`, but is otherwise the same as @@ -119,9 +275,29 @@ interface SubscriptionChangeServiceAsync { */ @MustBeClosed fun cancel( - params: SubscriptionChangeCancelParams + subscriptionChangeId: String ): CompletableFuture> = - cancel(params, RequestOptions.none()) + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none()) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + cancel( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + ): CompletableFuture> = + cancel(subscriptionChangeId, params, RequestOptions.none()) /** @see [cancel] */ @MustBeClosed @@ -129,5 +305,20 @@ interface SubscriptionChangeServiceAsync { params: SubscriptionChangeCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + params: SubscriptionChangeCancelParams + ): CompletableFuture> = + cancel(params, RequestOptions.none()) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt index dfa31c966..adb221d9f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -22,6 +23,7 @@ import com.withorb.api.models.SubscriptionChangeCancelResponse import com.withorb.api.models.SubscriptionChangeRetrieveParams import com.withorb.api.models.SubscriptionChangeRetrieveResponse import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class SubscriptionChangeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SubscriptionChangeServiceAsync { @@ -66,6 +68,9 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha params: SubscriptionChangeRetrieveParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionChangeId", params.subscriptionChangeId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -96,6 +101,9 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha params: SubscriptionChangeApplyParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionChangeId", params.subscriptionChangeId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -127,6 +135,9 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha params: SubscriptionChangeCancelParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionChangeId", params.subscriptionChangeId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt index f05488d1f..44bcb5115 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt @@ -305,8 +305,22 @@ interface SubscriptionServiceAsync { * This endpoint can be used to update the `metadata`, `net terms`, `auto_collection`, * `invoicing_threshold`, and `default_invoice_memo` properties on a subscription. */ - fun update(params: SubscriptionUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(subscriptionId: String): CompletableFuture = + update(subscriptionId, SubscriptionUpdateParams.none()) + + /** @see [update] */ + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [update] */ + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + ): CompletableFuture = update(subscriptionId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -314,6 +328,17 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: SubscriptionUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + update(subscriptionId, SubscriptionUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all subscriptions for an account as a * [paginated](/api-reference/pagination) list, ordered starting from the most recently created @@ -394,6 +419,21 @@ interface SubscriptionServiceAsync { * invoice and generate a new one based on the new dates for the subscription. See the section * on [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors). */ + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + ): CompletableFuture = + cancel(subscriptionId, params, RequestOptions.none()) + + /** @see [cancel] */ + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + cancel(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [cancel] */ fun cancel(params: SubscriptionCancelParams): CompletableFuture = cancel(params, RequestOptions.none()) @@ -407,8 +447,22 @@ interface SubscriptionServiceAsync { * This endpoint is used to fetch a [Subscription](/core-concepts##subscription) given an * identifier. */ - fun fetch(params: SubscriptionFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(subscriptionId: String): CompletableFuture = + fetch(subscriptionId, SubscriptionFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + ): CompletableFuture = fetch(subscriptionId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -416,6 +470,17 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: SubscriptionFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + fetch(subscriptionId, SubscriptionFetchParams.none(), requestOptions) + /** * This endpoint is used to fetch a day-by-day snapshot of a subscription's costs in Orb, * calculated by applying pricing information to the underlying usage (see the @@ -427,9 +492,23 @@ interface SubscriptionServiceAsync { * of costs to a specific subscription for the customer (e.g. to de-aggregate costs when a * customer's subscription has started and stopped on the same day). */ + fun fetchCosts(subscriptionId: String): CompletableFuture = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none()) + + /** @see [fetchCosts] */ fun fetchCosts( - params: SubscriptionFetchCostsParams - ): CompletableFuture = fetchCosts(params, RequestOptions.none()) + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetchCosts(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchCosts] */ + fun fetchCosts( + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + ): CompletableFuture = + fetchCosts(subscriptionId, params, RequestOptions.none()) /** @see [fetchCosts] */ fun fetchCosts( @@ -437,15 +516,42 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetchCosts] */ + fun fetchCosts( + params: SubscriptionFetchCostsParams + ): CompletableFuture = fetchCosts(params, RequestOptions.none()) + + /** @see [fetchCosts] */ + fun fetchCosts( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none(), requestOptions) + /** * This endpoint returns a [paginated](/api-reference/pagination) list of all plans associated * with a subscription along with their start and end dates. This list contains the * subscription's initial plan along with past and future plan changes. */ fun fetchSchedule( - params: SubscriptionFetchScheduleParams + subscriptionId: String ): CompletableFuture = - fetchSchedule(params, RequestOptions.none()) + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none()) + + /** @see [fetchSchedule] */ + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetchSchedule(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchSchedule] */ + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + ): CompletableFuture = + fetchSchedule(subscriptionId, params, RequestOptions.none()) /** @see [fetchSchedule] */ fun fetchSchedule( @@ -453,6 +559,19 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetchSchedule] */ + fun fetchSchedule( + params: SubscriptionFetchScheduleParams + ): CompletableFuture = + fetchSchedule(params, RequestOptions.none()) + + /** @see [fetchSchedule] */ + fun fetchSchedule( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none(), requestOptions) + /** * This endpoint is used to fetch a subscription's usage in Orb. Especially when combined with * optional query parameters, this endpoint is a powerful way to build visualizations on top of @@ -630,8 +749,23 @@ interface SubscriptionServiceAsync { * - `second_dimension_key`: `provider` * - `second_dimension_value`: `aws` */ - fun fetchUsage(params: SubscriptionFetchUsageParams): CompletableFuture = - fetchUsage(params, RequestOptions.none()) + fun fetchUsage(subscriptionId: String): CompletableFuture = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none()) + + /** @see [fetchUsage] */ + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetchUsage(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchUsage] */ + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + ): CompletableFuture = + fetchUsage(subscriptionId, params, RequestOptions.none()) /** @see [fetchUsage] */ fun fetchUsage( @@ -639,6 +773,17 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetchUsage] */ + fun fetchUsage(params: SubscriptionFetchUsageParams): CompletableFuture = + fetchUsage(params, RequestOptions.none()) + + /** @see [fetchUsage] */ + fun fetchUsage( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none(), requestOptions) + /** * This endpoint is used to add and edit subscription * [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By making @@ -707,9 +852,24 @@ interface SubscriptionServiceAsync { * intervals. */ fun priceIntervals( - params: SubscriptionPriceIntervalsParams + subscriptionId: String ): CompletableFuture = - priceIntervals(params, RequestOptions.none()) + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none()) + + /** @see [priceIntervals] */ + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + priceIntervals(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [priceIntervals] */ + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + ): CompletableFuture = + priceIntervals(subscriptionId, params, RequestOptions.none()) /** @see [priceIntervals] */ fun priceIntervals( @@ -717,6 +877,19 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [priceIntervals] */ + fun priceIntervals( + params: SubscriptionPriceIntervalsParams + ): CompletableFuture = + priceIntervals(params, RequestOptions.none()) + + /** @see [priceIntervals] */ + fun priceIntervals( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none(), requestOptions) + /** * This endpoint can be used to change an existing subscription's plan. It returns the * serialized updated subscription object. @@ -883,6 +1056,24 @@ interface SubscriptionServiceAsync { * change, adjusting the customer balance as needed. For details on this behavior, see * [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees). */ + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + ): CompletableFuture = + schedulePlanChange(subscriptionId, params, RequestOptions.none()) + + /** @see [schedulePlanChange] */ + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + schedulePlanChange( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [schedulePlanChange] */ fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams ): CompletableFuture = @@ -897,10 +1088,23 @@ interface SubscriptionServiceAsync { /** * Manually trigger a phase, effective the given date (or the current time, if not specified). */ + fun triggerPhase(subscriptionId: String): CompletableFuture = + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none()) + + /** @see [triggerPhase] */ fun triggerPhase( - params: SubscriptionTriggerPhaseParams + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture = - triggerPhase(params, RequestOptions.none()) + triggerPhase(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [triggerPhase] */ + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + ): CompletableFuture = + triggerPhase(subscriptionId, params, RequestOptions.none()) /** @see [triggerPhase] */ fun triggerPhase( @@ -908,6 +1112,19 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [triggerPhase] */ + fun triggerPhase( + params: SubscriptionTriggerPhaseParams + ): CompletableFuture = + triggerPhase(params, RequestOptions.none()) + + /** @see [triggerPhase] */ + fun triggerPhase( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none(), requestOptions) + /** * This endpoint can be used to unschedule any pending cancellations for a subscription. * @@ -916,9 +1133,29 @@ interface SubscriptionServiceAsync { * currently scheduled cancellation time. */ fun unscheduleCancellation( - params: SubscriptionUnscheduleCancellationParams + subscriptionId: String ): CompletableFuture = - unscheduleCancellation(params, RequestOptions.none()) + unscheduleCancellation(subscriptionId, SubscriptionUnscheduleCancellationParams.none()) + + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + unscheduleCancellation( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + ): CompletableFuture = + unscheduleCancellation(subscriptionId, params, RequestOptions.none()) /** @see [unscheduleCancellation] */ fun unscheduleCancellation( @@ -926,12 +1163,47 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + params: SubscriptionUnscheduleCancellationParams + ): CompletableFuture = + unscheduleCancellation(params, RequestOptions.none()) + + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + unscheduleCancellation( + subscriptionId, + SubscriptionUnscheduleCancellationParams.none(), + requestOptions, + ) + /** * This endpoint can be used to clear scheduled updates to the quantity for a fixed fee. * * If there are no updates scheduled, a request validation error will be returned with a 400 * status code. */ + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + ): CompletableFuture = + unscheduleFixedFeeQuantityUpdates(subscriptionId, params, RequestOptions.none()) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + unscheduleFixedFeeQuantityUpdates( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams ): CompletableFuture = @@ -947,9 +1219,32 @@ interface SubscriptionServiceAsync { * This endpoint can be used to unschedule any pending plan changes on an existing subscription. */ fun unschedulePendingPlanChanges( - params: SubscriptionUnschedulePendingPlanChangesParams + subscriptionId: String ): CompletableFuture = - unschedulePendingPlanChanges(params, RequestOptions.none()) + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + ) + + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + unschedulePendingPlanChanges( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + ): CompletableFuture = + unschedulePendingPlanChanges(subscriptionId, params, RequestOptions.none()) /** @see [unschedulePendingPlanChanges] */ fun unschedulePendingPlanChanges( @@ -957,6 +1252,23 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + params: SubscriptionUnschedulePendingPlanChangesParams + ): CompletableFuture = + unschedulePendingPlanChanges(params, RequestOptions.none()) + + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions, + ) + /** * This endpoint can be used to update the quantity for a fixed fee. * @@ -971,6 +1283,24 @@ interface SubscriptionServiceAsync { * If the fee is an in-advance fixed fee, it will also issue an immediate invoice for the * difference for the remainder of the billing period. */ + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + ): CompletableFuture = + updateFixedFeeQuantity(subscriptionId, params, RequestOptions.none()) + + /** @see [updateFixedFeeQuantity] */ + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + updateFixedFeeQuantity( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [updateFixedFeeQuantity] */ fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams ): CompletableFuture = @@ -1000,6 +1330,21 @@ interface SubscriptionServiceAsync { * scheduled or an add-on price was added, that change will be pushed back by the same amount of * time the trial is extended). */ + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + ): CompletableFuture = + updateTrial(subscriptionId, params, RequestOptions.none()) + + /** @see [updateTrial] */ + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + updateTrial(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [updateTrial] */ fun updateTrial( params: SubscriptionUpdateTrialParams ): CompletableFuture = @@ -1051,9 +1396,25 @@ interface SubscriptionServiceAsync { * the same as [SubscriptionServiceAsync.update]. */ @MustBeClosed + fun update(subscriptionId: String): CompletableFuture> = + update(subscriptionId, SubscriptionUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed fun update( - params: SubscriptionUpdateParams - ): CompletableFuture> = update(params, RequestOptions.none()) + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + ): CompletableFuture> = + update(subscriptionId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -1062,6 +1423,20 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update( + params: SubscriptionUpdateParams + ): CompletableFuture> = update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(subscriptionId, SubscriptionUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions`, but is otherwise the same as * [SubscriptionServiceAsync.list]. @@ -1096,6 +1471,23 @@ interface SubscriptionServiceAsync { * otherwise the same as [SubscriptionServiceAsync.cancel]. */ @MustBeClosed + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + ): CompletableFuture> = + cancel(subscriptionId, params, RequestOptions.none()) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + cancel(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [cancel] */ + @MustBeClosed fun cancel( params: SubscriptionCancelParams ): CompletableFuture> = @@ -1113,9 +1505,25 @@ interface SubscriptionServiceAsync { * the same as [SubscriptionServiceAsync.fetch]. */ @MustBeClosed + fun fetch(subscriptionId: String): CompletableFuture> = + fetch(subscriptionId, SubscriptionFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed fun fetch( - params: SubscriptionFetchParams - ): CompletableFuture> = fetch(params, RequestOptions.none()) + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + ): CompletableFuture> = + fetch(subscriptionId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -1124,15 +1532,46 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetch] */ + @MustBeClosed + fun fetch( + params: SubscriptionFetchParams + ): CompletableFuture> = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(subscriptionId, SubscriptionFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions/{subscription_id}/costs`, but is * otherwise the same as [SubscriptionServiceAsync.fetchCosts]. */ @MustBeClosed fun fetchCosts( - params: SubscriptionFetchCostsParams + subscriptionId: String ): CompletableFuture> = - fetchCosts(params, RequestOptions.none()) + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none()) + + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetchCosts(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + ): CompletableFuture> = + fetchCosts(subscriptionId, params, RequestOptions.none()) /** @see [fetchCosts] */ @MustBeClosed @@ -1141,15 +1580,47 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + params: SubscriptionFetchCostsParams + ): CompletableFuture> = + fetchCosts(params, RequestOptions.none()) + + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions/{subscription_id}/schedule`, but is * otherwise the same as [SubscriptionServiceAsync.fetchSchedule]. */ @MustBeClosed fun fetchSchedule( - params: SubscriptionFetchScheduleParams + subscriptionId: String ): CompletableFuture> = - fetchSchedule(params, RequestOptions.none()) + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none()) + + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetchSchedule(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + ): CompletableFuture> = + fetchSchedule(subscriptionId, params, RequestOptions.none()) /** @see [fetchSchedule] */ @MustBeClosed @@ -1158,15 +1629,47 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + params: SubscriptionFetchScheduleParams + ): CompletableFuture> = + fetchSchedule(params, RequestOptions.none()) + + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions/{subscription_id}/usage`, but is * otherwise the same as [SubscriptionServiceAsync.fetchUsage]. */ @MustBeClosed fun fetchUsage( - params: SubscriptionFetchUsageParams + subscriptionId: String ): CompletableFuture> = - fetchUsage(params, RequestOptions.none()) + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none()) + + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetchUsage(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + ): CompletableFuture> = + fetchUsage(subscriptionId, params, RequestOptions.none()) /** @see [fetchUsage] */ @MustBeClosed @@ -1175,15 +1678,50 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + params: SubscriptionFetchUsageParams + ): CompletableFuture> = + fetchUsage(params, RequestOptions.none()) + + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /subscriptions/{subscription_id}/price_intervals`, * but is otherwise the same as [SubscriptionServiceAsync.priceIntervals]. */ @MustBeClosed fun priceIntervals( - params: SubscriptionPriceIntervalsParams + subscriptionId: String ): CompletableFuture> = - priceIntervals(params, RequestOptions.none()) + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none()) + + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + priceIntervals( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + ): CompletableFuture> = + priceIntervals(subscriptionId, params, RequestOptions.none()) /** @see [priceIntervals] */ @MustBeClosed @@ -1192,12 +1730,47 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + params: SubscriptionPriceIntervalsParams + ): CompletableFuture> = + priceIntervals(params, RequestOptions.none()) + + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/schedule_plan_change`, but is otherwise the same as * [SubscriptionServiceAsync.schedulePlanChange]. */ @MustBeClosed + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + ): CompletableFuture> = + schedulePlanChange(subscriptionId, params, RequestOptions.none()) + + /** @see [schedulePlanChange] */ + @MustBeClosed + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + schedulePlanChange( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [schedulePlanChange] */ + @MustBeClosed fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams ): CompletableFuture> = @@ -1216,9 +1789,26 @@ interface SubscriptionServiceAsync { */ @MustBeClosed fun triggerPhase( - params: SubscriptionTriggerPhaseParams + subscriptionId: String ): CompletableFuture> = - triggerPhase(params, RequestOptions.none()) + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none()) + + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + triggerPhase(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + ): CompletableFuture> = + triggerPhase(subscriptionId, params, RequestOptions.none()) /** @see [triggerPhase] */ @MustBeClosed @@ -1227,6 +1817,21 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + params: SubscriptionTriggerPhaseParams + ): CompletableFuture> = + triggerPhase(params, RequestOptions.none()) + + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/unschedule_cancellation`, but is otherwise the same as @@ -1234,9 +1839,31 @@ interface SubscriptionServiceAsync { */ @MustBeClosed fun unscheduleCancellation( - params: SubscriptionUnscheduleCancellationParams + subscriptionId: String ): CompletableFuture> = - unscheduleCancellation(params, RequestOptions.none()) + unscheduleCancellation(subscriptionId, SubscriptionUnscheduleCancellationParams.none()) + + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + unscheduleCancellation( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + ): CompletableFuture> = + unscheduleCancellation(subscriptionId, params, RequestOptions.none()) /** @see [unscheduleCancellation] */ @MustBeClosed @@ -1245,12 +1872,54 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + params: SubscriptionUnscheduleCancellationParams + ): CompletableFuture> = + unscheduleCancellation(params, RequestOptions.none()) + + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + unscheduleCancellation( + subscriptionId, + SubscriptionUnscheduleCancellationParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/unschedule_fixed_fee_quantity_updates`, but is otherwise * the same as [SubscriptionServiceAsync.unscheduleFixedFeeQuantityUpdates]. */ @MustBeClosed + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + ): CompletableFuture< + HttpResponseFor + > = unscheduleFixedFeeQuantityUpdates(subscriptionId, params, RequestOptions.none()) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ + @MustBeClosed + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture< + HttpResponseFor + > = + unscheduleFixedFeeQuantityUpdates( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ + @MustBeClosed fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams ): CompletableFuture< @@ -1271,9 +1940,34 @@ interface SubscriptionServiceAsync { */ @MustBeClosed fun unschedulePendingPlanChanges( - params: SubscriptionUnschedulePendingPlanChangesParams + subscriptionId: String ): CompletableFuture> = - unschedulePendingPlanChanges(params, RequestOptions.none()) + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + ) + + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + unschedulePendingPlanChanges( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + ): CompletableFuture> = + unschedulePendingPlanChanges(subscriptionId, params, RequestOptions.none()) /** @see [unschedulePendingPlanChanges] */ @MustBeClosed @@ -1282,12 +1976,51 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + params: SubscriptionUnschedulePendingPlanChangesParams + ): CompletableFuture> = + unschedulePendingPlanChanges(params, RequestOptions.none()) + + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + subscriptionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/update_fixed_fee_quantity`, but is otherwise the same as * [SubscriptionServiceAsync.updateFixedFeeQuantity]. */ @MustBeClosed + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + ): CompletableFuture> = + updateFixedFeeQuantity(subscriptionId, params, RequestOptions.none()) + + /** @see [updateFixedFeeQuantity] */ + @MustBeClosed + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + updateFixedFeeQuantity( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [updateFixedFeeQuantity] */ + @MustBeClosed fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams ): CompletableFuture> = @@ -1305,6 +2038,23 @@ interface SubscriptionServiceAsync { * is otherwise the same as [SubscriptionServiceAsync.updateTrial]. */ @MustBeClosed + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + ): CompletableFuture> = + updateTrial(subscriptionId, params, RequestOptions.none()) + + /** @see [updateTrial] */ + @MustBeClosed + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + updateTrial(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [updateTrial] */ + @MustBeClosed fun updateTrial( params: SubscriptionUpdateTrialParams ): CompletableFuture> = diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt index add175fcb..4585b4d8e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -49,6 +50,7 @@ import com.withorb.api.models.SubscriptionUpdateTrialResponse import com.withorb.api.models.SubscriptionUsage import com.withorb.api.models.Subscriptions import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class SubscriptionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SubscriptionServiceAsync { @@ -218,6 +220,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -285,6 +290,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionCancelParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -315,6 +323,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -345,6 +356,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionFetchCostsParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -375,6 +389,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionFetchScheduleParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -411,6 +428,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionFetchUsageParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -441,6 +461,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionPriceIntervalsParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -472,6 +495,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionSchedulePlanChangeParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -503,6 +529,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionTriggerPhaseParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -535,6 +564,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionUnscheduleCancellationParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -575,6 +607,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption ): CompletableFuture< HttpResponseFor > { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -611,6 +646,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionUnschedulePendingPlanChangesParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -647,6 +685,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionUpdateFixedFeeQuantityParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -682,6 +723,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: SubscriptionUpdateTrialParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsync.kt index 751bbd3cd..1d03382a5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsync.kt @@ -22,9 +22,23 @@ interface SubscriptionServiceAsync { * subscription. For a full discussion of the subscription resource, see * [Subscription](/core-concepts#subscription). */ + fun list(couponId: String): CompletableFuture = + list(couponId, CouponSubscriptionListParams.none()) + + /** @see [list] */ fun list( - params: CouponSubscriptionListParams - ): CompletableFuture = list(params, RequestOptions.none()) + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [list] */ + fun list( + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + ): CompletableFuture = + list(couponId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -32,6 +46,18 @@ interface SubscriptionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [list] */ + fun list( + params: CouponSubscriptionListParams + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + couponId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(couponId, CouponSubscriptionListParams.none(), requestOptions) + /** * A view of [SubscriptionServiceAsync] that provides access to raw HTTP responses for each * method. @@ -44,9 +70,26 @@ interface SubscriptionServiceAsync { */ @MustBeClosed fun list( - params: CouponSubscriptionListParams + couponId: String ): CompletableFuture> = - list(params, RequestOptions.none()) + list(couponId, CouponSubscriptionListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + ): CompletableFuture> = + list(couponId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -54,5 +97,20 @@ interface SubscriptionServiceAsync { params: CouponSubscriptionListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [list] */ + @MustBeClosed + fun list( + params: CouponSubscriptionListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + couponId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(couponId, CouponSubscriptionListParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt index f749a531e..e28fbc6ce 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.coupons import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -18,6 +19,7 @@ import com.withorb.api.models.CouponSubscriptionListPageAsync import com.withorb.api.models.CouponSubscriptionListParams import com.withorb.api.models.Subscriptions import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class SubscriptionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SubscriptionServiceAsync { @@ -47,6 +49,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption params: CouponSubscriptionListParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("couponId", params.couponId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsync.kt index 7cbf4b6ac..482b9d44a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsync.kt @@ -22,6 +22,21 @@ interface BalanceTransactionServiceAsync { * Creates an immutable balance transaction that updates the customer's balance and returns back * the newly created transaction. */ + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + ): CompletableFuture = + create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ fun create( params: CustomerBalanceTransactionCreateParams ): CompletableFuture = @@ -60,10 +75,23 @@ interface BalanceTransactionServiceAsync { * synced to a separate invoicing provider. If a payment gateway such as Stripe is used, the * balance will be applied to the invoice before forwarding payment to the gateway. */ + fun list(customerId: String): CompletableFuture = + list(customerId, CustomerBalanceTransactionListParams.none()) + + /** @see [list] */ fun list( - params: CustomerBalanceTransactionListParams + customerId: String, + params: CustomerBalanceTransactionListParams = CustomerBalanceTransactionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture = - list(params, RequestOptions.none()) + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerBalanceTransactionListParams = CustomerBalanceTransactionListParams.none(), + ): CompletableFuture = + list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -71,6 +99,19 @@ interface BalanceTransactionServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [list] */ + fun list( + params: CustomerBalanceTransactionListParams + ): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(customerId, CustomerBalanceTransactionListParams.none(), requestOptions) + /** * A view of [BalanceTransactionServiceAsync] that provides access to raw HTTP responses for * each method. @@ -82,6 +123,23 @@ interface BalanceTransactionServiceAsync { * is otherwise the same as [BalanceTransactionServiceAsync.create]. */ @MustBeClosed + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + ): CompletableFuture> = + create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ + @MustBeClosed fun create( params: CustomerBalanceTransactionCreateParams ): CompletableFuture> = @@ -100,9 +158,28 @@ interface BalanceTransactionServiceAsync { */ @MustBeClosed fun list( - params: CustomerBalanceTransactionListParams + customerId: String ): CompletableFuture> = - list(params, RequestOptions.none()) + list(customerId, CustomerBalanceTransactionListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerBalanceTransactionListParams = + CustomerBalanceTransactionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerBalanceTransactionListParams = + CustomerBalanceTransactionListParams.none(), + ): CompletableFuture> = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -110,5 +187,20 @@ interface BalanceTransactionServiceAsync { params: CustomerBalanceTransactionListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerBalanceTransactionListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(customerId, CustomerBalanceTransactionListParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt index b2c2284d4..79c1e7524 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.customers import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -21,6 +22,7 @@ import com.withorb.api.models.CustomerBalanceTransactionListPageAsync import com.withorb.api.models.CustomerBalanceTransactionListPageResponse import com.withorb.api.models.CustomerBalanceTransactionListParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class BalanceTransactionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : BalanceTransactionServiceAsync { @@ -58,6 +60,9 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact params: CustomerBalanceTransactionCreateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -89,6 +94,9 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact params: CustomerBalanceTransactionListParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt index 1474003bc..945da63dd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt @@ -128,8 +128,22 @@ interface CostServiceAsync { * `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` and * `secondary_grouping_value` available. */ - fun list(params: CustomerCostListParams): CompletableFuture = - list(params, RequestOptions.none()) + fun list(customerId: String): CompletableFuture = + list(customerId, CustomerCostListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + ): CompletableFuture = list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -137,6 +151,17 @@ interface CostServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [list] */ + fun list(params: CustomerCostListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(customerId, CustomerCostListParams.none(), requestOptions) + /** * This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated * by applying pricing information to the underlying usage (see the @@ -248,9 +273,27 @@ interface CostServiceAsync { * `secondary_grouping_value` available. */ fun listByExternalId( - params: CustomerCostListByExternalIdParams + externalCustomerId: String ): CompletableFuture = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCostListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + ): CompletableFuture = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -258,6 +301,23 @@ interface CostServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCostListByExternalIdParams + ): CompletableFuture = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listByExternalId( + externalCustomerId, + CustomerCostListByExternalIdParams.none(), + requestOptions, + ) + /** A view of [CostServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -266,10 +326,25 @@ interface CostServiceAsync { * the same as [CostServiceAsync.list]. */ @MustBeClosed + fun list(customerId: String): CompletableFuture> = + list(customerId, CustomerCostListParams.none()) + + /** @see [list] */ + @MustBeClosed fun list( - params: CustomerCostListParams + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> = - list(params, RequestOptions.none()) + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + ): CompletableFuture> = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -278,6 +353,21 @@ interface CostServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerCostListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(customerId, CustomerCostListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get * /customers/external_customer_id/{external_customer_id}/costs`, but is otherwise the same @@ -285,9 +375,29 @@ interface CostServiceAsync { */ @MustBeClosed fun listByExternalId( - params: CustomerCostListByExternalIdParams + externalCustomerId: String ): CompletableFuture> = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCostListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + ): CompletableFuture> = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -295,5 +405,24 @@ interface CostServiceAsync { params: CustomerCostListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCostListByExternalIdParams + ): CompletableFuture> = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listByExternalId( + externalCustomerId, + CustomerCostListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncImpl.kt index 5a17f858f..494151842 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.customers import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -19,6 +20,7 @@ import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class CostServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CostServiceAsync { @@ -56,6 +58,9 @@ class CostServiceAsyncImpl internal constructor(private val clientOptions: Clien params: CustomerCostListParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -86,6 +91,9 @@ class CostServiceAsyncImpl internal constructor(private val clientOptions: Clien params: CustomerCostListByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsync.kt index a07d73d2c..a20d114b5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsync.kt @@ -33,8 +33,23 @@ interface CreditServiceAsync { * Note that `currency` defaults to credits if not specified. To use a real world currency, set * `currency` to an ISO 4217 string. */ - fun list(params: CustomerCreditListParams): CompletableFuture = - list(params, RequestOptions.none()) + fun list(customerId: String): CompletableFuture = + list(customerId, CustomerCreditListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + ): CompletableFuture = + list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -42,6 +57,17 @@ interface CreditServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [list] */ + fun list(params: CustomerCreditListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(customerId, CustomerCreditListParams.none(), requestOptions) + /** * Returns a paginated list of unexpired, non-zero credit blocks for a customer. * @@ -52,9 +78,27 @@ interface CreditServiceAsync { * `currency` to an ISO 4217 string. */ fun listByExternalId( - params: CustomerCreditListByExternalIdParams + externalCustomerId: String ): CompletableFuture = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = CustomerCreditListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = CustomerCreditListByExternalIdParams.none(), + ): CompletableFuture = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -62,6 +106,23 @@ interface CreditServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCreditListByExternalIdParams + ): CompletableFuture = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listByExternalId( + externalCustomerId, + CustomerCreditListByExternalIdParams.none(), + requestOptions, + ) + /** * A view of [CreditServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -77,9 +138,26 @@ interface CreditServiceAsync { */ @MustBeClosed fun list( - params: CustomerCreditListParams + customerId: String ): CompletableFuture> = - list(params, RequestOptions.none()) + list(customerId, CustomerCreditListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + ): CompletableFuture> = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -88,6 +166,21 @@ interface CreditServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerCreditListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(customerId, CustomerCreditListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get * /customers/external_customer_id/{external_customer_id}/credits`, but is otherwise the @@ -95,9 +188,31 @@ interface CreditServiceAsync { */ @MustBeClosed fun listByExternalId( - params: CustomerCreditListByExternalIdParams + externalCustomerId: String ): CompletableFuture> = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = + CustomerCreditListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = + CustomerCreditListByExternalIdParams.none(), + ): CompletableFuture> = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -105,5 +220,24 @@ interface CreditServiceAsync { params: CustomerCreditListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCreditListByExternalIdParams + ): CompletableFuture> = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listByExternalId( + externalCustomerId, + CustomerCreditListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt index 39fad882b..9ac2482ae 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.customers import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -25,6 +26,7 @@ import com.withorb.api.services.async.customers.credits.LedgerServiceAsyncImpl import com.withorb.api.services.async.customers.credits.TopUpServiceAsync import com.withorb.api.services.async.customers.credits.TopUpServiceAsyncImpl import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class CreditServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CreditServiceAsync { @@ -82,6 +84,9 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CustomerCreditListParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -119,6 +124,9 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CustomerCreditListByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt index 3b9bc08a4..1c297c33b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt @@ -101,9 +101,23 @@ interface LedgerServiceAsync { * When credits are added to a customer's balance as a result of a correction, this entry will * be added to the ledger to indicate the adjustment of credits. */ + fun list(customerId: String): CompletableFuture = + list(customerId, CustomerCreditLedgerListParams.none()) + + /** @see [list] */ fun list( - params: CustomerCreditLedgerListParams - ): CompletableFuture = list(params, RequestOptions.none()) + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + ): CompletableFuture = + list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -111,6 +125,18 @@ interface LedgerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [list] */ + fun list( + params: CustomerCreditLedgerListParams + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(customerId, CustomerCreditLedgerListParams.none(), requestOptions) + /** * This endpoint allows you to create a new ledger entry for a specified customer's balance. * This can be used to increment balance, deduct credits, and change the expiry date of existing @@ -214,6 +240,21 @@ interface LedgerServiceAsync { * decremented from, and `amount` indicates how many credits to return to the customer, up to * the block's initial balance. */ + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + ): CompletableFuture = + createEntry(customerId, params, RequestOptions.none()) + + /** @see [createEntry] */ + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createEntry(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createEntry] */ fun createEntry( params: CustomerCreditLedgerCreateEntryParams ): CompletableFuture = @@ -328,6 +369,24 @@ interface LedgerServiceAsync { * decremented from, and `amount` indicates how many credits to return to the customer, up to * the block's initial balance. */ + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + ): CompletableFuture = + createEntryByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createEntryByExternalId] */ + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createEntryByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createEntryByExternalId] */ fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams ): CompletableFuture = @@ -419,9 +478,29 @@ interface LedgerServiceAsync { * be added to the ledger to indicate the adjustment of credits. */ fun listByExternalId( - params: CustomerCreditLedgerListByExternalIdParams + externalCustomerId: String ): CompletableFuture = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditLedgerListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + ): CompletableFuture = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -429,6 +508,23 @@ interface LedgerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCreditLedgerListByExternalIdParams + ): CompletableFuture = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listByExternalId( + externalCustomerId, + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions, + ) + /** * A view of [LedgerServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -440,9 +536,26 @@ interface LedgerServiceAsync { */ @MustBeClosed fun list( - params: CustomerCreditLedgerListParams + customerId: String ): CompletableFuture> = - list(params, RequestOptions.none()) + list(customerId, CustomerCreditLedgerListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + ): CompletableFuture> = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -451,11 +564,43 @@ interface LedgerServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerCreditLedgerListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(customerId, CustomerCreditLedgerListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /customers/{customer_id}/credits/ledger_entry`, but * is otherwise the same as [LedgerServiceAsync.createEntry]. */ @MustBeClosed + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + ): CompletableFuture> = + createEntry(customerId, params, RequestOptions.none()) + + /** @see [createEntry] */ + @MustBeClosed + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createEntry(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createEntry] */ + @MustBeClosed fun createEntry( params: CustomerCreditLedgerCreateEntryParams ): CompletableFuture> = @@ -474,6 +619,26 @@ interface LedgerServiceAsync { * otherwise the same as [LedgerServiceAsync.createEntryByExternalId]. */ @MustBeClosed + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + ): CompletableFuture> = + createEntryByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createEntryByExternalId] */ + @MustBeClosed + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createEntryByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createEntryByExternalId] */ + @MustBeClosed fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams ): CompletableFuture> = @@ -493,9 +658,31 @@ interface LedgerServiceAsync { */ @MustBeClosed fun listByExternalId( - params: CustomerCreditLedgerListByExternalIdParams + externalCustomerId: String ): CompletableFuture> = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditLedgerListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + ): CompletableFuture> = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -503,5 +690,24 @@ interface LedgerServiceAsync { params: CustomerCreditLedgerListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCreditLedgerListByExternalIdParams + ): CompletableFuture> = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listByExternalId( + externalCustomerId, + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt index 111daf6ab..eb3adce31 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.customers.credits import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -26,6 +27,7 @@ import com.withorb.api.models.CustomerCreditLedgerListPageAsync import com.withorb.api.models.CustomerCreditLedgerListPageResponse import com.withorb.api.models.CustomerCreditLedgerListParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class LedgerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : LedgerServiceAsync { @@ -77,6 +79,9 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CustomerCreditLedgerListParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -114,6 +119,9 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CustomerCreditLedgerCreateEntryParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -148,6 +156,9 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CustomerCreditLedgerCreateEntryByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -186,6 +197,9 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli params: CustomerCreditLedgerListByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt index 0dce0c982..2b6ec8caa 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt @@ -33,6 +33,21 @@ interface TopUpServiceAsync { * If a top-up already exists for this customer in the same currency, the existing top-up will * be replaced. */ + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + ): CompletableFuture = + create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ fun create( params: CustomerCreditTopUpCreateParams ): CompletableFuture = create(params, RequestOptions.none()) @@ -44,9 +59,23 @@ interface TopUpServiceAsync { ): CompletableFuture /** List top-ups */ + fun list(customerId: String): CompletableFuture = + list(customerId, CustomerCreditTopUpListParams.none()) + + /** @see [list] */ fun list( - params: CustomerCreditTopUpListParams - ): CompletableFuture = list(params, RequestOptions.none()) + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + ): CompletableFuture = + list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -54,10 +83,34 @@ interface TopUpServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [list] */ + fun list( + params: CustomerCreditTopUpListParams + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(customerId, CustomerCreditTopUpListParams.none(), requestOptions) + /** * This deactivates the top-up and voids any invoices associated with pending credit blocks * purchased through the top-up. */ + fun delete(topUpId: String, params: CustomerCreditTopUpDeleteParams): CompletableFuture = + delete(topUpId, params, RequestOptions.none()) + + /** @see [delete] */ + fun delete( + topUpId: String, + params: CustomerCreditTopUpDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + delete(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [delete] */ fun delete(params: CustomerCreditTopUpDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) @@ -75,6 +128,24 @@ interface TopUpServiceAsync { * If a top-up already exists for this customer in the same currency, the existing top-up will * be replaced. */ + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + ): CompletableFuture = + createByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createByExternalId] */ + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createByExternalId] */ fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams ): CompletableFuture = @@ -90,6 +161,20 @@ interface TopUpServiceAsync { * This deactivates the top-up and voids any invoices associated with pending credit blocks * purchased through the top-up. */ + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + ): CompletableFuture = deleteByExternalId(topUpId, params, RequestOptions.none()) + + /** @see [deleteByExternalId] */ + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + deleteByExternalId(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [deleteByExternalId] */ fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams ): CompletableFuture = deleteByExternalId(params, RequestOptions.none()) @@ -102,9 +187,29 @@ interface TopUpServiceAsync { /** List top-ups by external ID */ fun listByExternalId( - params: CustomerCreditTopUpListByExternalIdParams + externalCustomerId: String ): CompletableFuture = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditTopUpListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + ): CompletableFuture = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -112,6 +217,23 @@ interface TopUpServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCreditTopUpListByExternalIdParams + ): CompletableFuture = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listByExternalId( + externalCustomerId, + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions, + ) + /** A view of [TopUpServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -120,6 +242,23 @@ interface TopUpServiceAsync { * otherwise the same as [TopUpServiceAsync.create]. */ @MustBeClosed + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + ): CompletableFuture> = + create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ + @MustBeClosed fun create( params: CustomerCreditTopUpCreateParams ): CompletableFuture> = @@ -138,9 +277,26 @@ interface TopUpServiceAsync { */ @MustBeClosed fun list( - params: CustomerCreditTopUpListParams + customerId: String ): CompletableFuture> = - list(params, RequestOptions.none()) + list(customerId, CustomerCreditTopUpListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + ): CompletableFuture> = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -149,12 +305,43 @@ interface TopUpServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerCreditTopUpListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(customerId, CustomerCreditTopUpListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `delete * /customers/{customer_id}/credits/top_ups/{top_up_id}`, but is otherwise the same as * [TopUpServiceAsync.delete]. */ @MustBeClosed + fun delete( + topUpId: String, + params: CustomerCreditTopUpDeleteParams, + ): CompletableFuture = delete(topUpId, params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + topUpId: String, + params: CustomerCreditTopUpDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + delete(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [delete] */ + @MustBeClosed fun delete(params: CustomerCreditTopUpDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) @@ -171,6 +358,26 @@ interface TopUpServiceAsync { * the same as [TopUpServiceAsync.createByExternalId]. */ @MustBeClosed + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + ): CompletableFuture> = + createByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createByExternalId] */ + @MustBeClosed + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createByExternalId] */ + @MustBeClosed fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams ): CompletableFuture> = @@ -189,6 +396,23 @@ interface TopUpServiceAsync { * is otherwise the same as [TopUpServiceAsync.deleteByExternalId]. */ @MustBeClosed + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + ): CompletableFuture = + deleteByExternalId(topUpId, params, RequestOptions.none()) + + /** @see [deleteByExternalId] */ + @MustBeClosed + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + deleteByExternalId(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [deleteByExternalId] */ + @MustBeClosed fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams ): CompletableFuture = deleteByExternalId(params, RequestOptions.none()) @@ -207,9 +431,31 @@ interface TopUpServiceAsync { */ @MustBeClosed fun listByExternalId( - params: CustomerCreditTopUpListByExternalIdParams + externalCustomerId: String ): CompletableFuture> = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditTopUpListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + ): CompletableFuture> = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -217,5 +463,24 @@ interface TopUpServiceAsync { params: CustomerCreditTopUpListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCreditTopUpListByExternalIdParams + ): CompletableFuture> = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listByExternalId( + externalCustomerId, + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt index 09ca25318..f197f7793 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.customers.credits import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.emptyHandler import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler @@ -30,6 +31,7 @@ import com.withorb.api.models.CustomerCreditTopUpListPageAsync import com.withorb.api.models.CustomerCreditTopUpListPageResponse import com.withorb.api.models.CustomerCreditTopUpListParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class TopUpServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : TopUpServiceAsync { @@ -95,6 +97,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie params: CustomerCreditTopUpCreateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -126,6 +131,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie params: CustomerCreditTopUpListParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -161,6 +169,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie params: CustomerCreditTopUpDeleteParams, requestOptions: RequestOptions, ): CompletableFuture { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("topUpId", params.topUpId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.DELETE) @@ -191,6 +202,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie params: CustomerCreditTopUpCreateByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -227,6 +241,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie params: CustomerCreditTopUpDeleteByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("topUpId", params.topUpId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.DELETE) @@ -258,6 +275,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie params: CustomerCreditTopUpListByExternalIdParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsync.kt index eeb23832c..7648ae7d6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsync.kt @@ -18,8 +18,35 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { /** Fetch dimensional price group by external ID */ fun retrieve( - params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams - ): CompletableFuture = retrieve(params, RequestOptions.none()) + externalDimensionalPriceGroupId: String + ): CompletableFuture = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ) + + /** @see [retrieve] */ + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve( + params + .toBuilder() + .externalDimensionalPriceGroupId(externalDimensionalPriceGroupId) + .build(), + requestOptions, + ) + + /** @see [retrieve] */ + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ): CompletableFuture = + retrieve(externalDimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -27,6 +54,22 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [retrieve] */ + fun retrieve( + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + externalDimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions, + ) + /** * A view of [ExternalDimensionalPriceGroupIdServiceAsync] that provides access to raw HTTP * responses for each method. @@ -40,9 +83,37 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { */ @MustBeClosed fun retrieve( - params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams + externalDimensionalPriceGroupId: String ): CompletableFuture> = - retrieve(params, RequestOptions.none()) + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve( + params + .toBuilder() + .externalDimensionalPriceGroupId(externalDimensionalPriceGroupId) + .build(), + requestOptions, + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ): CompletableFuture> = + retrieve(externalDimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -50,5 +121,24 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + externalDimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncImpl.kt index 811a2580b..e7f51a777 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.dimensionalPriceGroups import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -17,6 +18,7 @@ import com.withorb.api.core.prepareAsync import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class ExternalDimensionalPriceGroupIdServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -51,6 +53,12 @@ internal constructor(private val clientOptions: ClientOptions) : params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired( + "externalDimensionalPriceGroupId", + params.externalDimensionalPriceGroupId().getOrNull(), + ) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsync.kt index aeace6ac2..209e019d4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsync.kt @@ -93,8 +93,23 @@ interface BackfillServiceAsync { * asynchronously reflect the updated usage in invoice amounts and usage graphs. Once all of the * updates are complete, the backfill's status will transition to `reflected`. */ - fun close(params: EventBackfillCloseParams): CompletableFuture = - close(params, RequestOptions.none()) + fun close(backfillId: String): CompletableFuture = + close(backfillId, EventBackfillCloseParams.none()) + + /** @see [close] */ + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + close(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [close] */ + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + ): CompletableFuture = + close(backfillId, params, RequestOptions.none()) /** @see [close] */ fun close( @@ -102,9 +117,35 @@ interface BackfillServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [close] */ + fun close(params: EventBackfillCloseParams): CompletableFuture = + close(params, RequestOptions.none()) + + /** @see [close] */ + fun close( + backfillId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + close(backfillId, EventBackfillCloseParams.none(), requestOptions) + /** This endpoint is used to fetch a backfill given an identifier. */ - fun fetch(params: EventBackfillFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(backfillId: String): CompletableFuture = + fetch(backfillId, EventBackfillFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + ): CompletableFuture = + fetch(backfillId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -112,6 +153,17 @@ interface BackfillServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: EventBackfillFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch( + backfillId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + fetch(backfillId, EventBackfillFetchParams.none(), requestOptions) + /** * Reverting a backfill undoes all the effects of closing the backfill. If the backfill is * reflected, the status will transition to `pending_revert` while the effects of the backfill @@ -120,8 +172,23 @@ interface BackfillServiceAsync { * If a backfill is reverted before its closed, no usage will be updated as a result of the * backfill and it will immediately transition to `reverted`. */ - fun revert(params: EventBackfillRevertParams): CompletableFuture = - revert(params, RequestOptions.none()) + fun revert(backfillId: String): CompletableFuture = + revert(backfillId, EventBackfillRevertParams.none()) + + /** @see [revert] */ + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + revert(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [revert] */ + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + ): CompletableFuture = + revert(backfillId, params, RequestOptions.none()) /** @see [revert] */ fun revert( @@ -129,6 +196,17 @@ interface BackfillServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [revert] */ + fun revert(params: EventBackfillRevertParams): CompletableFuture = + revert(params, RequestOptions.none()) + + /** @see [revert] */ + fun revert( + backfillId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + revert(backfillId, EventBackfillRevertParams.none(), requestOptions) + /** * A view of [BackfillServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -186,9 +264,26 @@ interface BackfillServiceAsync { */ @MustBeClosed fun close( - params: EventBackfillCloseParams + backfillId: String ): CompletableFuture> = - close(params, RequestOptions.none()) + close(backfillId, EventBackfillCloseParams.none()) + + /** @see [close] */ + @MustBeClosed + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + close(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [close] */ + @MustBeClosed + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + ): CompletableFuture> = + close(backfillId, params, RequestOptions.none()) /** @see [close] */ @MustBeClosed @@ -197,15 +292,47 @@ interface BackfillServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [close] */ + @MustBeClosed + fun close( + params: EventBackfillCloseParams + ): CompletableFuture> = + close(params, RequestOptions.none()) + + /** @see [close] */ + @MustBeClosed + fun close( + backfillId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + close(backfillId, EventBackfillCloseParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /events/backfills/{backfill_id}`, but is otherwise * the same as [BackfillServiceAsync.fetch]. */ @MustBeClosed fun fetch( - params: EventBackfillFetchParams + backfillId: String ): CompletableFuture> = - fetch(params, RequestOptions.none()) + fetch(backfillId, EventBackfillFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + ): CompletableFuture> = + fetch(backfillId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -214,15 +341,47 @@ interface BackfillServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [fetch] */ + @MustBeClosed + fun fetch( + params: EventBackfillFetchParams + ): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + backfillId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(backfillId, EventBackfillFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /events/backfills/{backfill_id}/revert`, but is * otherwise the same as [BackfillServiceAsync.revert]. */ @MustBeClosed fun revert( - params: EventBackfillRevertParams + backfillId: String ): CompletableFuture> = - revert(params, RequestOptions.none()) + revert(backfillId, EventBackfillRevertParams.none()) + + /** @see [revert] */ + @MustBeClosed + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + revert(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [revert] */ + @MustBeClosed + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + ): CompletableFuture> = + revert(backfillId, params, RequestOptions.none()) /** @see [revert] */ @MustBeClosed @@ -230,5 +389,20 @@ interface BackfillServiceAsync { params: EventBackfillRevertParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [revert] */ + @MustBeClosed + fun revert( + params: EventBackfillRevertParams + ): CompletableFuture> = + revert(params, RequestOptions.none()) + + /** @see [revert] */ + @MustBeClosed + fun revert( + backfillId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + revert(backfillId, EventBackfillRevertParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt index cff62b177..510741db9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.events import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -27,6 +28,7 @@ import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class BackfillServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : BackfillServiceAsync { @@ -153,6 +155,9 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C params: EventBackfillCloseParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("backfillId", params.backfillId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -184,6 +189,9 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C params: EventBackfillFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("backfillId", params.backfillId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -214,6 +222,9 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C params: EventBackfillRevertParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("backfillId", params.backfillId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsync.kt index fc671e068..2dc9d70ad 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsync.kt @@ -23,8 +23,22 @@ interface ExternalPlanIdServiceAsync { * * Other fields on a customer are currently immutable. */ - fun update(params: PlanExternalPlanIdUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(otherExternalPlanId: String): CompletableFuture = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none()) + + /** @see [update] */ + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().otherExternalPlanId(otherExternalPlanId).build(), requestOptions) + + /** @see [update] */ + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + ): CompletableFuture = update(otherExternalPlanId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -32,6 +46,17 @@ interface ExternalPlanIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: PlanExternalPlanIdUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + otherExternalPlanId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none(), requestOptions) + /** * This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details given an * external_plan_id identifier. It returns information about the prices included in the plan and @@ -49,8 +74,22 @@ interface ExternalPlanIdServiceAsync { * detailed explanation of price types can be found in the * [Price schema](/core-concepts#plan-and-price). " */ - fun fetch(params: PlanExternalPlanIdFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(externalPlanId: String): CompletableFuture = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().externalPlanId(externalPlanId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + ): CompletableFuture = fetch(externalPlanId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -58,6 +97,14 @@ interface ExternalPlanIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: PlanExternalPlanIdFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(externalPlanId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none(), requestOptions) + /** * A view of [ExternalPlanIdServiceAsync] that provides access to raw HTTP responses for each * method. @@ -69,9 +116,28 @@ interface ExternalPlanIdServiceAsync { * otherwise the same as [ExternalPlanIdServiceAsync.update]. */ @MustBeClosed + fun update(otherExternalPlanId: String): CompletableFuture> = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed fun update( - params: PlanExternalPlanIdUpdateParams - ): CompletableFuture> = update(params, RequestOptions.none()) + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update( + params.toBuilder().otherExternalPlanId(otherExternalPlanId).build(), + requestOptions, + ) + + /** @see [update] */ + @MustBeClosed + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + ): CompletableFuture> = + update(otherExternalPlanId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -80,13 +146,44 @@ interface ExternalPlanIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update( + params: PlanExternalPlanIdUpdateParams + ): CompletableFuture> = update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + otherExternalPlanId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /plans/external_plan_id/{external_plan_id}`, but is * otherwise the same as [ExternalPlanIdServiceAsync.fetch]. */ @MustBeClosed - fun fetch(params: PlanExternalPlanIdFetchParams): CompletableFuture> = - fetch(params, RequestOptions.none()) + fun fetch(externalPlanId: String): CompletableFuture> = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().externalPlanId(externalPlanId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + ): CompletableFuture> = + fetch(externalPlanId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -94,5 +191,18 @@ interface ExternalPlanIdServiceAsync { params: PlanExternalPlanIdFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PlanExternalPlanIdFetchParams): CompletableFuture> = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPlanId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncImpl.kt index 8d77ebf59..ca1c846f3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.plans import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -19,6 +20,7 @@ import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class ExternalPlanIdServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdServiceAsync { @@ -55,6 +57,9 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS params: PlanExternalPlanIdUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("otherExternalPlanId", params.otherExternalPlanId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -85,6 +90,9 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS params: PlanExternalPlanIdFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalPlanId", params.externalPlanId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsync.kt index 702ab4155..6b90d6a30 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsync.kt @@ -21,8 +21,22 @@ interface ExternalPriceIdServiceAsync { * This endpoint allows you to update the `metadata` property on a price. If you pass null for * the metadata value, it will clear any existing metadata for that price. */ - fun update(params: PriceExternalPriceIdUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) + fun update(externalPriceId: String): CompletableFuture = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none()) + + /** @see [update] */ + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [update] */ + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + ): CompletableFuture = update(externalPriceId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -30,13 +44,35 @@ interface ExternalPriceIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [update] */ + fun update(params: PriceExternalPriceIdUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(externalPriceId: String, requestOptions: RequestOptions): CompletableFuture = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none(), requestOptions) + /** * This endpoint returns a price given an external price id. See the * [price creation API](/api-reference/price/create-price) for more information about external * price aliases. */ - fun fetch(params: PriceExternalPriceIdFetchParams): CompletableFuture = - fetch(params, RequestOptions.none()) + fun fetch(externalPriceId: String): CompletableFuture = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + fetch(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + ): CompletableFuture = fetch(externalPriceId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -44,6 +80,14 @@ interface ExternalPriceIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see [fetch] */ + fun fetch(params: PriceExternalPriceIdFetchParams): CompletableFuture = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(externalPriceId: String, requestOptions: RequestOptions): CompletableFuture = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none(), requestOptions) + /** * A view of [ExternalPriceIdServiceAsync] that provides access to raw HTTP responses for each * method. @@ -55,9 +99,25 @@ interface ExternalPriceIdServiceAsync { * is otherwise the same as [ExternalPriceIdServiceAsync.update]. */ @MustBeClosed + fun update(externalPriceId: String): CompletableFuture> = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed fun update( - params: PriceExternalPriceIdUpdateParams - ): CompletableFuture> = update(params, RequestOptions.none()) + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + ): CompletableFuture> = + update(externalPriceId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -66,14 +126,44 @@ interface ExternalPriceIdServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** @see [update] */ + @MustBeClosed + fun update( + params: PriceExternalPriceIdUpdateParams + ): CompletableFuture> = update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + externalPriceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /prices/external_price_id/{external_price_id}`, but * is otherwise the same as [ExternalPriceIdServiceAsync.fetch]. */ @MustBeClosed + fun fetch(externalPriceId: String): CompletableFuture> = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed fun fetch( - params: PriceExternalPriceIdFetchParams - ): CompletableFuture> = fetch(params, RequestOptions.none()) + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + fetch(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + ): CompletableFuture> = + fetch(externalPriceId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -81,5 +171,19 @@ interface ExternalPriceIdServiceAsync { params: PriceExternalPriceIdFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + params: PriceExternalPriceIdFetchParams + ): CompletableFuture> = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPriceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncImpl.kt index b8bf55ab1..da2d7057e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async.prices import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -19,6 +20,7 @@ import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class ExternalPriceIdServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ExternalPriceIdServiceAsync { @@ -55,6 +57,9 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPriceId params: PriceExternalPriceIdUpdateParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalPriceId", params.externalPriceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -85,6 +90,9 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPriceId params: PriceExternalPriceIdFetchParams, requestOptions: RequestOptions, ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalPriceId", params.externalPriceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertService.kt index e2b633a3a..8d4a2b0f7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertService.kt @@ -24,7 +24,18 @@ interface AlertService { fun withRawResponse(): WithRawResponse /** This endpoint retrieves an alert by its ID. */ - fun retrieve(params: AlertRetrieveParams): Alert = retrieve(params, RequestOptions.none()) + fun retrieve(alertId: String): Alert = retrieve(alertId, AlertRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = retrieve(params.toBuilder().alertId(alertId).build(), requestOptions) + + /** @see [retrieve] */ + fun retrieve(alertId: String, params: AlertRetrieveParams = AlertRetrieveParams.none()): Alert = + retrieve(alertId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -32,7 +43,29 @@ interface AlertService { requestOptions: RequestOptions = RequestOptions.none(), ): Alert + /** @see [retrieve] */ + fun retrieve(params: AlertRetrieveParams): Alert = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve(alertId: String, requestOptions: RequestOptions): Alert = + retrieve(alertId, AlertRetrieveParams.none(), requestOptions) + /** This endpoint updates the thresholds of an alert. */ + fun update(alertConfigurationId: String, params: AlertUpdateParams): Alert = + update(alertConfigurationId, params, RequestOptions.none()) + + /** @see [update] */ + fun update( + alertConfigurationId: String, + params: AlertUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = + update( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [update] */ fun update(params: AlertUpdateParams): Alert = update(params, RequestOptions.none()) /** @see [update] */ @@ -76,6 +109,17 @@ interface AlertService { * `credit_balance_dropped` alerts require a list of thresholds to be provided while * `credit_balance_depleted` and `credit_balance_recovered` alerts do not require thresholds. */ + fun createForCustomer(customerId: String, params: AlertCreateForCustomerParams): Alert = + createForCustomer(customerId, params, RequestOptions.none()) + + /** @see [createForCustomer] */ + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = createForCustomer(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createForCustomer] */ fun createForCustomer(params: AlertCreateForCustomerParams): Alert = createForCustomer(params, RequestOptions.none()) @@ -93,6 +137,23 @@ interface AlertService { * `credit_balance_dropped` alerts require a list of thresholds to be provided while * `credit_balance_depleted` and `credit_balance_recovered` alerts do not require thresholds. */ + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + ): Alert = createForExternalCustomer(externalCustomerId, params, RequestOptions.none()) + + /** @see [createForExternalCustomer] */ + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = + createForExternalCustomer( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createForExternalCustomer] */ fun createForExternalCustomer(params: AlertCreateForExternalCustomerParams): Alert = createForExternalCustomer(params, RequestOptions.none()) @@ -114,6 +175,23 @@ interface AlertService { * per metric that is a part of the subscription. Alerts are triggered based on usage or cost * conditions met during the current billing cycle. */ + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + ): Alert = createForSubscription(subscriptionId, params, RequestOptions.none()) + + /** @see [createForSubscription] */ + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = + createForSubscription( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [createForSubscription] */ fun createForSubscription(params: AlertCreateForSubscriptionParams): Alert = createForSubscription(params, RequestOptions.none()) @@ -128,7 +206,25 @@ interface AlertService { * subscription, you must include the `subscription_id`. The `subscription_id` is not required * for customer or subscription level alerts. */ - fun disable(params: AlertDisableParams): Alert = disable(params, RequestOptions.none()) + fun disable(alertConfigurationId: String): Alert = + disable(alertConfigurationId, AlertDisableParams.none()) + + /** @see [disable] */ + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = + disable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [disable] */ + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + ): Alert = disable(alertConfigurationId, params, RequestOptions.none()) /** @see [disable] */ fun disable( @@ -136,12 +232,37 @@ interface AlertService { requestOptions: RequestOptions = RequestOptions.none(), ): Alert + /** @see [disable] */ + fun disable(params: AlertDisableParams): Alert = disable(params, RequestOptions.none()) + + /** @see [disable] */ + fun disable(alertConfigurationId: String, requestOptions: RequestOptions): Alert = + disable(alertConfigurationId, AlertDisableParams.none(), requestOptions) + /** * This endpoint allows you to enable an alert. To enable a plan-level alert for a specific * subscription, you must include the `subscription_id`. The `subscription_id` is not required * for customer or subscription level alerts. */ - fun enable(params: AlertEnableParams): Alert = enable(params, RequestOptions.none()) + fun enable(alertConfigurationId: String): Alert = + enable(alertConfigurationId, AlertEnableParams.none()) + + /** @see [enable] */ + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Alert = + enable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [enable] */ + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + ): Alert = enable(alertConfigurationId, params, RequestOptions.none()) /** @see [enable] */ fun enable( @@ -149,6 +270,13 @@ interface AlertService { requestOptions: RequestOptions = RequestOptions.none(), ): Alert + /** @see [enable] */ + fun enable(params: AlertEnableParams): Alert = enable(params, RequestOptions.none()) + + /** @see [enable] */ + fun enable(alertConfigurationId: String, requestOptions: RequestOptions): Alert = + enable(alertConfigurationId, AlertEnableParams.none(), requestOptions) + /** A view of [AlertService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -157,8 +285,24 @@ interface AlertService { * [AlertService.retrieve]. */ @MustBeClosed - fun retrieve(params: AlertRetrieveParams): HttpResponseFor = - retrieve(params, RequestOptions.none()) + fun retrieve(alertId: String): HttpResponseFor = + retrieve(alertId, AlertRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().alertId(alertId).build(), requestOptions) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + alertId: String, + params: AlertRetrieveParams = AlertRetrieveParams.none(), + ): HttpResponseFor = retrieve(alertId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -167,11 +311,40 @@ interface AlertService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [retrieve] */ + @MustBeClosed + fun retrieve(params: AlertRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve(alertId: String, requestOptions: RequestOptions): HttpResponseFor = + retrieve(alertId, AlertRetrieveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `put /alerts/{alert_configuration_id}`, but is otherwise * the same as [AlertService.update]. */ @MustBeClosed + fun update( + alertConfigurationId: String, + params: AlertUpdateParams, + ): HttpResponseFor = update(alertConfigurationId, params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + alertConfigurationId: String, + params: AlertUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [update] */ + @MustBeClosed fun update(params: AlertUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) @@ -210,6 +383,22 @@ interface AlertService { * otherwise the same as [AlertService.createForCustomer]. */ @MustBeClosed + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + ): HttpResponseFor = createForCustomer(customerId, params, RequestOptions.none()) + + /** @see [createForCustomer] */ + @MustBeClosed + fun createForCustomer( + customerId: String, + params: AlertCreateForCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createForCustomer(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createForCustomer] */ + @MustBeClosed fun createForCustomer(params: AlertCreateForCustomerParams): HttpResponseFor = createForCustomer(params, RequestOptions.none()) @@ -226,6 +415,26 @@ interface AlertService { * [AlertService.createForExternalCustomer]. */ @MustBeClosed + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + ): HttpResponseFor = + createForExternalCustomer(externalCustomerId, params, RequestOptions.none()) + + /** @see [createForExternalCustomer] */ + @MustBeClosed + fun createForExternalCustomer( + externalCustomerId: String, + params: AlertCreateForExternalCustomerParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createForExternalCustomer( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createForExternalCustomer] */ + @MustBeClosed fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams ): HttpResponseFor = createForExternalCustomer(params, RequestOptions.none()) @@ -242,6 +451,26 @@ interface AlertService { * otherwise the same as [AlertService.createForSubscription]. */ @MustBeClosed + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + ): HttpResponseFor = + createForSubscription(subscriptionId, params, RequestOptions.none()) + + /** @see [createForSubscription] */ + @MustBeClosed + fun createForSubscription( + subscriptionId: String, + params: AlertCreateForSubscriptionParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createForSubscription( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [createForSubscription] */ + @MustBeClosed fun createForSubscription( params: AlertCreateForSubscriptionParams ): HttpResponseFor = createForSubscription(params, RequestOptions.none()) @@ -258,8 +487,27 @@ interface AlertService { * otherwise the same as [AlertService.disable]. */ @MustBeClosed - fun disable(params: AlertDisableParams): HttpResponseFor = - disable(params, RequestOptions.none()) + fun disable(alertConfigurationId: String): HttpResponseFor = + disable(alertConfigurationId, AlertDisableParams.none()) + + /** @see [disable] */ + @MustBeClosed + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + disable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [disable] */ + @MustBeClosed + fun disable( + alertConfigurationId: String, + params: AlertDisableParams = AlertDisableParams.none(), + ): HttpResponseFor = disable(alertConfigurationId, params, RequestOptions.none()) /** @see [disable] */ @MustBeClosed @@ -268,13 +516,45 @@ interface AlertService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [disable] */ + @MustBeClosed + fun disable(params: AlertDisableParams): HttpResponseFor = + disable(params, RequestOptions.none()) + + /** @see [disable] */ + @MustBeClosed + fun disable( + alertConfigurationId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + disable(alertConfigurationId, AlertDisableParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /alerts/{alert_configuration_id}/enable`, but is * otherwise the same as [AlertService.enable]. */ @MustBeClosed - fun enable(params: AlertEnableParams): HttpResponseFor = - enable(params, RequestOptions.none()) + fun enable(alertConfigurationId: String): HttpResponseFor = + enable(alertConfigurationId, AlertEnableParams.none()) + + /** @see [enable] */ + @MustBeClosed + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + enable( + params.toBuilder().alertConfigurationId(alertConfigurationId).build(), + requestOptions, + ) + + /** @see [enable] */ + @MustBeClosed + fun enable( + alertConfigurationId: String, + params: AlertEnableParams = AlertEnableParams.none(), + ): HttpResponseFor = enable(alertConfigurationId, params, RequestOptions.none()) /** @see [enable] */ @MustBeClosed @@ -282,5 +562,18 @@ interface AlertService { params: AlertEnableParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [enable] */ + @MustBeClosed + fun enable(params: AlertEnableParams): HttpResponseFor = + enable(params, RequestOptions.none()) + + /** @see [enable] */ + @MustBeClosed + fun enable( + alertConfigurationId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + enable(alertConfigurationId, AlertEnableParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertServiceImpl.kt index 31e2fed93..c3c729de2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/AlertServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -26,6 +27,7 @@ import com.withorb.api.models.AlertListPageResponse import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams +import kotlin.jvm.optionals.getOrNull class AlertServiceImpl internal constructor(private val clientOptions: ClientOptions) : AlertService { @@ -89,6 +91,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertRetrieveParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertId", params.alertId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -115,6 +120,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertConfigurationId", params.alertConfigurationId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -176,6 +184,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertCreateForCustomerParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -203,6 +214,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertCreateForExternalCustomerParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -230,6 +244,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertCreateForSubscriptionParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -257,6 +274,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertDisableParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertConfigurationId", params.alertConfigurationId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -284,6 +304,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt params: AlertEnableParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("alertConfigurationId", params.alertConfigurationId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponService.kt index 6a9a557a4..e3c3e65e2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponService.kt @@ -63,7 +63,20 @@ interface CouponService { * will be hidden from lists of active coupons. Additionally, once a coupon is archived, its * redemption code can be reused for a different coupon. */ - fun archive(params: CouponArchiveParams): Coupon = archive(params, RequestOptions.none()) + fun archive(couponId: String): Coupon = archive(couponId, CouponArchiveParams.none()) + + /** @see [archive] */ + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Coupon = archive(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [archive] */ + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + ): Coupon = archive(couponId, params, RequestOptions.none()) /** @see [archive] */ fun archive( @@ -71,11 +84,29 @@ interface CouponService { requestOptions: RequestOptions = RequestOptions.none(), ): Coupon + /** @see [archive] */ + fun archive(params: CouponArchiveParams): Coupon = archive(params, RequestOptions.none()) + + /** @see [archive] */ + fun archive(couponId: String, requestOptions: RequestOptions): Coupon = + archive(couponId, CouponArchiveParams.none(), requestOptions) + /** * This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption code, use * the [List coupons](list-coupons) endpoint with the redemption_code parameter. */ - fun fetch(params: CouponFetchParams): Coupon = fetch(params, RequestOptions.none()) + fun fetch(couponId: String): Coupon = fetch(couponId, CouponFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Coupon = fetch(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch(couponId: String, params: CouponFetchParams = CouponFetchParams.none()): Coupon = + fetch(couponId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -83,6 +114,13 @@ interface CouponService { requestOptions: RequestOptions = RequestOptions.none(), ): Coupon + /** @see [fetch] */ + fun fetch(params: CouponFetchParams): Coupon = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(couponId: String, requestOptions: RequestOptions): Coupon = + fetch(couponId, CouponFetchParams.none(), requestOptions) + /** A view of [CouponService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -132,8 +170,24 @@ interface CouponService { * same as [CouponService.archive]. */ @MustBeClosed - fun archive(params: CouponArchiveParams): HttpResponseFor = - archive(params, RequestOptions.none()) + fun archive(couponId: String): HttpResponseFor = + archive(couponId, CouponArchiveParams.none()) + + /** @see [archive] */ + @MustBeClosed + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + archive(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [archive] */ + @MustBeClosed + fun archive( + couponId: String, + params: CouponArchiveParams = CouponArchiveParams.none(), + ): HttpResponseFor = archive(couponId, params, RequestOptions.none()) /** @see [archive] */ @MustBeClosed @@ -142,13 +196,39 @@ interface CouponService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [archive] */ + @MustBeClosed + fun archive(params: CouponArchiveParams): HttpResponseFor = + archive(params, RequestOptions.none()) + + /** @see [archive] */ + @MustBeClosed + fun archive(couponId: String, requestOptions: RequestOptions): HttpResponseFor = + archive(couponId, CouponArchiveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /coupons/{coupon_id}`, but is otherwise the same as * [CouponService.fetch]. */ @MustBeClosed - fun fetch(params: CouponFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(couponId: String): HttpResponseFor = + fetch(couponId, CouponFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + couponId: String, + params: CouponFetchParams = CouponFetchParams.none(), + ): HttpResponseFor = fetch(couponId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -156,5 +236,15 @@ interface CouponService { params: CouponFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: CouponFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(couponId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(couponId, CouponFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponServiceImpl.kt index 517aa4ba6..5d27644d6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CouponServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -24,6 +25,7 @@ import com.withorb.api.models.CouponListPageResponse import com.withorb.api.models.CouponListParams import com.withorb.api.services.blocking.coupons.SubscriptionService import com.withorb.api.services.blocking.coupons.SubscriptionServiceImpl +import kotlin.jvm.optionals.getOrNull class CouponServiceImpl internal constructor(private val clientOptions: ClientOptions) : CouponService { @@ -135,6 +137,9 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp params: CouponArchiveParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("couponId", params.couponId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -162,6 +167,9 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp params: CouponFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("couponId", params.couponId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt index a2e0cba4f..972aaf767 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt @@ -52,7 +52,20 @@ interface CreditNoteService { * This endpoint is used to fetch a single [`Credit Note`](/invoicing/credit-notes) given an * identifier. */ - fun fetch(params: CreditNoteFetchParams): CreditNote = fetch(params, RequestOptions.none()) + fun fetch(creditNoteId: String): CreditNote = fetch(creditNoteId, CreditNoteFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CreditNote = fetch(params.toBuilder().creditNoteId(creditNoteId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + ): CreditNote = fetch(creditNoteId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -60,6 +73,13 @@ interface CreditNoteService { requestOptions: RequestOptions = RequestOptions.none(), ): CreditNote + /** @see [fetch] */ + fun fetch(params: CreditNoteFetchParams): CreditNote = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(creditNoteId: String, requestOptions: RequestOptions): CreditNote = + fetch(creditNoteId, CreditNoteFetchParams.none(), requestOptions) + /** A view of [CreditNoteService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -108,8 +128,24 @@ interface CreditNoteService { * the same as [CreditNoteService.fetch]. */ @MustBeClosed - fun fetch(params: CreditNoteFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(creditNoteId: String): HttpResponseFor = + fetch(creditNoteId, CreditNoteFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().creditNoteId(creditNoteId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + creditNoteId: String, + params: CreditNoteFetchParams = CreditNoteFetchParams.none(), + ): HttpResponseFor = fetch(creditNoteId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -117,5 +153,18 @@ interface CreditNoteService { params: CreditNoteFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: CreditNoteFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + creditNoteId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetch(creditNoteId, CreditNoteFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteServiceImpl.kt index a036d08b6..883d149af 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -21,6 +22,7 @@ import com.withorb.api.models.CreditNoteFetchParams import com.withorb.api.models.CreditNoteListPage import com.withorb.api.models.CreditNoteListPageResponse import com.withorb.api.models.CreditNoteListParams +import kotlin.jvm.optionals.getOrNull class CreditNoteServiceImpl internal constructor(private val clientOptions: ClientOptions) : CreditNoteService { @@ -122,6 +124,9 @@ class CreditNoteServiceImpl internal constructor(private val clientOptions: Clie params: CreditNoteFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("creditNoteId", params.creditNoteId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt index 2d62be98b..ac6eecbca 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt @@ -61,7 +61,20 @@ interface CustomerService { * `billing_address`, and `additional_emails` of an existing customer. Other fields on a * customer are currently immutable. */ - fun update(params: CustomerUpdateParams): Customer = update(params, RequestOptions.none()) + fun update(customerId: String): Customer = update(customerId, CustomerUpdateParams.none()) + + /** @see [update] */ + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Customer = update(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [update] */ + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + ): Customer = update(customerId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -69,6 +82,13 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): Customer + /** @see [update] */ + fun update(params: CustomerUpdateParams): Customer = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(customerId: String, requestOptions: RequestOptions): Customer = + update(customerId, CustomerUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all customers for an account. The list of customers is * ordered starting from the most recently created customer. This endpoint follows Orb's @@ -107,11 +127,29 @@ interface CustomerService { * * On successful processing, this returns an empty dictionary (`{}`) in the API. */ - fun delete(params: CustomerDeleteParams) = delete(params, RequestOptions.none()) + fun delete(customerId: String) = delete(customerId, CustomerDeleteParams.none()) + + /** @see [delete] */ + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ) = delete(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [delete] */ + fun delete(customerId: String, params: CustomerDeleteParams = CustomerDeleteParams.none()) = + delete(customerId, params, RequestOptions.none()) /** @see [delete] */ fun delete(params: CustomerDeleteParams, requestOptions: RequestOptions = RequestOptions.none()) + /** @see [delete] */ + fun delete(params: CustomerDeleteParams) = delete(params, RequestOptions.none()) + + /** @see [delete] */ + fun delete(customerId: String, requestOptions: RequestOptions) = + delete(customerId, CustomerDeleteParams.none(), requestOptions) + /** * This endpoint is used to fetch customer details given an identifier. If the `Customer` is in * the process of being deleted, only the properties `id` and `deleted: true` will be returned. @@ -119,7 +157,20 @@ interface CustomerService { * See the [Customer resource](/core-concepts#customer) for a full discussion of the Customer * model. */ - fun fetch(params: CustomerFetchParams): Customer = fetch(params, RequestOptions.none()) + fun fetch(customerId: String): Customer = fetch(customerId, CustomerFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Customer = fetch(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + ): Customer = fetch(customerId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -127,6 +178,13 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): Customer + /** @see [fetch] */ + fun fetch(params: CustomerFetchParams): Customer = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(customerId: String, requestOptions: RequestOptions): Customer = + fetch(customerId, CustomerFetchParams.none(), requestOptions) + /** * This endpoint is used to fetch customer details given an `external_customer_id` (see * [Customer ID Aliases](/events-and-metrics/customer-aliases)). @@ -134,8 +192,25 @@ interface CustomerService { * Note that the resource and semantics of this endpoint exactly mirror * [Get Customer](fetch-customer). */ - fun fetchByExternalId(params: CustomerFetchByExternalIdParams): Customer = - fetchByExternalId(params, RequestOptions.none()) + fun fetchByExternalId(externalCustomerId: String): Customer = + fetchByExternalId(externalCustomerId, CustomerFetchByExternalIdParams.none()) + + /** @see [fetchByExternalId] */ + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Customer = + fetchByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [fetchByExternalId] */ + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + ): Customer = fetchByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [fetchByExternalId] */ fun fetchByExternalId( @@ -143,6 +218,18 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): Customer + /** @see [fetchByExternalId] */ + fun fetchByExternalId(params: CustomerFetchByExternalIdParams): Customer = + fetchByExternalId(params, RequestOptions.none()) + + /** @see [fetchByExternalId] */ + fun fetchByExternalId(externalCustomerId: String, requestOptions: RequestOptions): Customer = + fetchByExternalId( + externalCustomerId, + CustomerFetchByExternalIdParams.none(), + requestOptions, + ) + /** * Sync Orb's payment methods for the customer with their gateway. * @@ -151,8 +238,30 @@ interface CustomerService { * * **Note**: This functionality is currently only available for Stripe. */ - fun syncPaymentMethodsFromGateway(params: CustomerSyncPaymentMethodsFromGatewayParams) = - syncPaymentMethodsFromGateway(params, RequestOptions.none()) + fun syncPaymentMethodsFromGateway(customerId: String) = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ) + + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway( + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ) = + syncPaymentMethodsFromGateway( + params.toBuilder().customerId(customerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway( + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ) = syncPaymentMethodsFromGateway(customerId, params, RequestOptions.none()) /** @see [syncPaymentMethodsFromGateway] */ fun syncPaymentMethodsFromGateway( @@ -160,6 +269,18 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ) + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway(params: CustomerSyncPaymentMethodsFromGatewayParams) = + syncPaymentMethodsFromGateway(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGateway] */ + fun syncPaymentMethodsFromGateway(customerId: String, requestOptions: RequestOptions) = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions, + ) + /** * Sync Orb's payment methods for the customer with their gateway. * @@ -168,9 +289,35 @@ interface CustomerService { * * **Note**: This functionality is currently only available for Stripe. */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId(externalCustomerId: String) = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ fun syncPaymentMethodsFromGatewayByExternalCustomerId( - params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams - ) = syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ) = + syncPaymentMethodsFromGatewayByExternalCustomerId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ) = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + params, + RequestOptions.none(), + ) /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ fun syncPaymentMethodsFromGatewayByExternalCustomerId( @@ -178,13 +325,42 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ) + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + ) = syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + requestOptions: RequestOptions, + ) = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions, + ) + /** * This endpoint is used to update customer details given an `external_customer_id` (see * [Customer ID Aliases](/events-and-metrics/customer-aliases)). Note that the resource and * semantics of this endpoint exactly mirror [Update Customer](update-customer). */ - fun updateByExternalId(params: CustomerUpdateByExternalIdParams): Customer = - updateByExternalId(params, RequestOptions.none()) + fun updateByExternalId(id: String): Customer = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none()) + + /** @see [updateByExternalId] */ + fun updateByExternalId( + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Customer = updateByExternalId(params.toBuilder().id(id).build(), requestOptions) + + /** @see [updateByExternalId] */ + fun updateByExternalId( + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + ): Customer = updateByExternalId(id, params, RequestOptions.none()) /** @see [updateByExternalId] */ fun updateByExternalId( @@ -192,6 +368,14 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): Customer + /** @see [updateByExternalId] */ + fun updateByExternalId(params: CustomerUpdateByExternalIdParams): Customer = + updateByExternalId(params, RequestOptions.none()) + + /** @see [updateByExternalId] */ + fun updateByExternalId(id: String, requestOptions: RequestOptions): Customer = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none(), requestOptions) + /** A view of [CustomerService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -221,8 +405,24 @@ interface CustomerService { * as [CustomerService.update]. */ @MustBeClosed - fun update(params: CustomerUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(customerId: String): HttpResponseFor = + update(customerId, CustomerUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + customerId: String, + params: CustomerUpdateParams = CustomerUpdateParams.none(), + ): HttpResponseFor = update(customerId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -231,6 +431,16 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: CustomerUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update(customerId: String, requestOptions: RequestOptions): HttpResponseFor = + update(customerId, CustomerUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /customers`, but is otherwise the same as * [CustomerService.list]. @@ -261,8 +471,23 @@ interface CustomerService { * same as [CustomerService.delete]. */ @MustBeClosed - fun delete(params: CustomerDeleteParams): HttpResponse = - delete(params, RequestOptions.none()) + fun delete(customerId: String): HttpResponse = + delete(customerId, CustomerDeleteParams.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = delete(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [delete] */ + @MustBeClosed + fun delete( + customerId: String, + params: CustomerDeleteParams = CustomerDeleteParams.none(), + ): HttpResponse = delete(customerId, params, RequestOptions.none()) /** @see [delete] */ @MustBeClosed @@ -271,13 +496,39 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponse + /** @see [delete] */ + @MustBeClosed + fun delete(params: CustomerDeleteParams): HttpResponse = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete(customerId: String, requestOptions: RequestOptions): HttpResponse = + delete(customerId, CustomerDeleteParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /customers/{customer_id}`, but is otherwise the same * as [CustomerService.fetch]. */ @MustBeClosed - fun fetch(params: CustomerFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(customerId: String): HttpResponseFor = + fetch(customerId, CustomerFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + customerId: String, + params: CustomerFetchParams = CustomerFetchParams.none(), + ): HttpResponseFor = fetch(customerId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -286,14 +537,44 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: CustomerFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(customerId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(customerId, CustomerFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get * /customers/external_customer_id/{external_customer_id}`, but is otherwise the same as * [CustomerService.fetchByExternalId]. */ @MustBeClosed - fun fetchByExternalId(params: CustomerFetchByExternalIdParams): HttpResponseFor = - fetchByExternalId(params, RequestOptions.none()) + fun fetchByExternalId(externalCustomerId: String): HttpResponseFor = + fetchByExternalId(externalCustomerId, CustomerFetchByExternalIdParams.none()) + + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetchByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + externalCustomerId: String, + params: CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams.none(), + ): HttpResponseFor = + fetchByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [fetchByExternalId] */ @MustBeClosed @@ -302,15 +583,55 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId(params: CustomerFetchByExternalIdParams): HttpResponseFor = + fetchByExternalId(params, RequestOptions.none()) + + /** @see [fetchByExternalId] */ + @MustBeClosed + fun fetchByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetchByExternalId( + externalCustomerId, + CustomerFetchByExternalIdParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /customers/{customer_id}/sync_payment_methods_from_gateway`, but is otherwise the same as * [CustomerService.syncPaymentMethodsFromGateway]. */ @MustBeClosed + fun syncPaymentMethodsFromGateway(customerId: String): HttpResponse = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ) + + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed fun syncPaymentMethodsFromGateway( - params: CustomerSyncPaymentMethodsFromGatewayParams - ): HttpResponse = syncPaymentMethodsFromGateway(params, RequestOptions.none()) + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = + syncPaymentMethodsFromGateway( + params.toBuilder().customerId(customerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed + fun syncPaymentMethodsFromGateway( + customerId: String, + params: CustomerSyncPaymentMethodsFromGatewayParams = + CustomerSyncPaymentMethodsFromGatewayParams.none(), + ): HttpResponse = syncPaymentMethodsFromGateway(customerId, params, RequestOptions.none()) /** @see [syncPaymentMethodsFromGateway] */ @MustBeClosed @@ -319,6 +640,24 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponse + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed + fun syncPaymentMethodsFromGateway( + params: CustomerSyncPaymentMethodsFromGatewayParams + ): HttpResponse = syncPaymentMethodsFromGateway(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGateway] */ + @MustBeClosed + fun syncPaymentMethodsFromGateway( + customerId: String, + requestOptions: RequestOptions, + ): HttpResponse = + syncPaymentMethodsFromGateway( + customerId, + CustomerSyncPaymentMethodsFromGatewayParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway`, @@ -327,9 +666,38 @@ interface CustomerService { */ @MustBeClosed fun syncPaymentMethodsFromGatewayByExternalCustomerId( - params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + externalCustomerId: String ): HttpResponse = - syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = + syncPaymentMethodsFromGatewayByExternalCustomerId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + ): HttpResponse = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + params, + RequestOptions.none(), + ) /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ @MustBeClosed @@ -338,15 +706,49 @@ interface CustomerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponse + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams + ): HttpResponse = + syncPaymentMethodsFromGatewayByExternalCustomerId(params, RequestOptions.none()) + + /** @see [syncPaymentMethodsFromGatewayByExternalCustomerId] */ + @MustBeClosed + fun syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): HttpResponse = + syncPaymentMethodsFromGatewayByExternalCustomerId( + externalCustomerId, + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `put * /customers/external_customer_id/{external_customer_id}`, but is otherwise the same as * [CustomerService.updateByExternalId]. */ @MustBeClosed + fun updateByExternalId(id: String): HttpResponseFor = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none()) + + /** @see [updateByExternalId] */ + @MustBeClosed fun updateByExternalId( - params: CustomerUpdateByExternalIdParams - ): HttpResponseFor = updateByExternalId(params, RequestOptions.none()) + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + updateByExternalId(params.toBuilder().id(id).build(), requestOptions) + + /** @see [updateByExternalId] */ + @MustBeClosed + fun updateByExternalId( + id: String, + params: CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams.none(), + ): HttpResponseFor = updateByExternalId(id, params, RequestOptions.none()) /** @see [updateByExternalId] */ @MustBeClosed @@ -354,5 +756,19 @@ interface CustomerService { params: CustomerUpdateByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [updateByExternalId] */ + @MustBeClosed + fun updateByExternalId( + params: CustomerUpdateByExternalIdParams + ): HttpResponseFor = updateByExternalId(params, RequestOptions.none()) + + /** @see [updateByExternalId] */ + @MustBeClosed + fun updateByExternalId( + id: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + updateByExternalId(id, CustomerUpdateByExternalIdParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt index da329b172..06e163453 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.emptyHandler import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler @@ -35,6 +36,7 @@ import com.withorb.api.services.blocking.customers.CostService import com.withorb.api.services.blocking.customers.CostServiceImpl import com.withorb.api.services.blocking.customers.CreditService import com.withorb.api.services.blocking.customers.CreditServiceImpl +import kotlin.jvm.optionals.getOrNull class CustomerServiceImpl internal constructor(private val clientOptions: ClientOptions) : CustomerService { @@ -172,6 +174,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -232,6 +237,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerDeleteParams, requestOptions: RequestOptions, ): HttpResponse { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.DELETE) @@ -251,6 +259,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -277,6 +288,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerFetchByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -303,6 +317,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerSyncPaymentMethodsFromGatewayParams, requestOptions: RequestOptions, ): HttpResponse { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -328,6 +345,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, requestOptions: RequestOptions, ): HttpResponse { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -354,6 +374,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerUpdateByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("id", params.id().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupService.kt index 862f99259..8df6a108f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupService.kt @@ -40,8 +40,25 @@ interface DimensionalPriceGroupService { ): DimensionalPriceGroup /** Fetch dimensional price group */ - fun retrieve(params: DimensionalPriceGroupRetrieveParams): DimensionalPriceGroup = - retrieve(params, RequestOptions.none()) + fun retrieve(dimensionalPriceGroupId: String): DimensionalPriceGroup = + retrieve(dimensionalPriceGroupId, DimensionalPriceGroupRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): DimensionalPriceGroup = + retrieve( + params.toBuilder().dimensionalPriceGroupId(dimensionalPriceGroupId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + fun retrieve( + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams.none(), + ): DimensionalPriceGroup = retrieve(dimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -49,6 +66,21 @@ interface DimensionalPriceGroupService { requestOptions: RequestOptions = RequestOptions.none(), ): DimensionalPriceGroup + /** @see [retrieve] */ + fun retrieve(params: DimensionalPriceGroupRetrieveParams): DimensionalPriceGroup = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + dimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): DimensionalPriceGroup = + retrieve( + dimensionalPriceGroupId, + DimensionalPriceGroupRetrieveParams.none(), + requestOptions, + ) + /** List dimensional price groups */ fun list(): DimensionalPriceGroupListPage = list(DimensionalPriceGroupListParams.none()) @@ -98,9 +130,29 @@ interface DimensionalPriceGroupService { * [DimensionalPriceGroupService.retrieve]. */ @MustBeClosed + fun retrieve(dimensionalPriceGroupId: String): HttpResponseFor = + retrieve(dimensionalPriceGroupId, DimensionalPriceGroupRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed fun retrieve( - params: DimensionalPriceGroupRetrieveParams - ): HttpResponseFor = retrieve(params, RequestOptions.none()) + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = + DimensionalPriceGroupRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve( + params.toBuilder().dimensionalPriceGroupId(dimensionalPriceGroupId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + dimensionalPriceGroupId: String, + params: DimensionalPriceGroupRetrieveParams = DimensionalPriceGroupRetrieveParams.none(), + ): HttpResponseFor = + retrieve(dimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -109,6 +161,24 @@ interface DimensionalPriceGroupService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: DimensionalPriceGroupRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + dimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve( + dimensionalPriceGroupId, + DimensionalPriceGroupRetrieveParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `get /dimensional_price_groups`, but is otherwise the * same as [DimensionalPriceGroupService.list]. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceImpl.kt index 5aef96249..7f600f1db 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -23,6 +24,7 @@ import com.withorb.api.models.DimensionalPriceGroupRetrieveParams import com.withorb.api.models.DimensionalPriceGroups import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdService import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceImpl +import kotlin.jvm.optionals.getOrNull class DimensionalPriceGroupServiceImpl internal constructor(private val clientOptions: ClientOptions) : DimensionalPriceGroupService { @@ -110,6 +112,9 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric params: DimensionalPriceGroupRetrieveParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("dimensionalPriceGroupId", params.dimensionalPriceGroupId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventService.kt index fbf459ffa..432a8d3a6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventService.kt @@ -68,6 +68,17 @@ interface EventService { * period. For higher volume updates, consider using the [event backfill](create-backfill) * endpoint. */ + fun update(eventId: String, params: EventUpdateParams): EventUpdateResponse = + update(eventId, params, RequestOptions.none()) + + /** @see [update] */ + fun update( + eventId: String, + params: EventUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): EventUpdateResponse = update(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [update] */ fun update(params: EventUpdateParams): EventUpdateResponse = update(params, RequestOptions.none()) @@ -113,8 +124,22 @@ interface EventService { * period. For higher volume updates, consider using the [event backfill](create-backfill) * endpoint. */ - fun deprecate(params: EventDeprecateParams): EventDeprecateResponse = - deprecate(params, RequestOptions.none()) + fun deprecate(eventId: String): EventDeprecateResponse = + deprecate(eventId, EventDeprecateParams.none()) + + /** @see [deprecate] */ + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): EventDeprecateResponse = + deprecate(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [deprecate] */ + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + ): EventDeprecateResponse = deprecate(eventId, params, RequestOptions.none()) /** @see [deprecate] */ fun deprecate( @@ -122,6 +147,14 @@ interface EventService { requestOptions: RequestOptions = RequestOptions.none(), ): EventDeprecateResponse + /** @see [deprecate] */ + fun deprecate(params: EventDeprecateParams): EventDeprecateResponse = + deprecate(params, RequestOptions.none()) + + /** @see [deprecate] */ + fun deprecate(eventId: String, requestOptions: RequestOptions): EventDeprecateResponse = + deprecate(eventId, EventDeprecateParams.none(), requestOptions) + /** * Orb's event ingestion model and API is designed around two core principles: * 1. **Data fidelity**: The accuracy of your billing model depends on a robust foundation of @@ -359,6 +392,22 @@ interface EventService { * [EventService.update]. */ @MustBeClosed + fun update( + eventId: String, + params: EventUpdateParams, + ): HttpResponseFor = update(eventId, params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + eventId: String, + params: EventUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed fun update(params: EventUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) @@ -374,8 +423,25 @@ interface EventService { * same as [EventService.deprecate]. */ @MustBeClosed - fun deprecate(params: EventDeprecateParams): HttpResponseFor = - deprecate(params, RequestOptions.none()) + fun deprecate(eventId: String): HttpResponseFor = + deprecate(eventId, EventDeprecateParams.none()) + + /** @see [deprecate] */ + @MustBeClosed + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + deprecate(params.toBuilder().eventId(eventId).build(), requestOptions) + + /** @see [deprecate] */ + @MustBeClosed + fun deprecate( + eventId: String, + params: EventDeprecateParams = EventDeprecateParams.none(), + ): HttpResponseFor = + deprecate(eventId, params, RequestOptions.none()) /** @see [deprecate] */ @MustBeClosed @@ -384,6 +450,19 @@ interface EventService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [deprecate] */ + @MustBeClosed + fun deprecate(params: EventDeprecateParams): HttpResponseFor = + deprecate(params, RequestOptions.none()) + + /** @see [deprecate] */ + @MustBeClosed + fun deprecate( + eventId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + deprecate(eventId, EventDeprecateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /ingest`, but is otherwise the same as * [EventService.ingest]. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventServiceImpl.kt index 9a48a5530..7c3bb7c37 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/EventServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -27,6 +28,7 @@ import com.withorb.api.services.blocking.events.BackfillService import com.withorb.api.services.blocking.events.BackfillServiceImpl import com.withorb.api.services.blocking.events.VolumeService import com.withorb.api.services.blocking.events.VolumeServiceImpl +import kotlin.jvm.optionals.getOrNull class EventServiceImpl internal constructor(private val clientOptions: ClientOptions) : EventService { @@ -98,6 +100,9 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt params: EventUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("eventId", params.eventId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -126,6 +131,9 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt params: EventDeprecateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("eventId", params.eventId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt index 8aa45bfb0..ff6d49260 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt @@ -40,7 +40,20 @@ interface InvoiceService { * * `metadata` can be modified regardless of invoice state. */ - fun update(params: InvoiceUpdateParams): Invoice = update(params, RequestOptions.none()) + fun update(invoiceId: String): Invoice = update(invoiceId, InvoiceUpdateParams.none()) + + /** @see [update] */ + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Invoice = update(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [update] */ + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + ): Invoice = update(invoiceId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -48,6 +61,13 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): Invoice + /** @see [update] */ + fun update(params: InvoiceUpdateParams): Invoice = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(invoiceId: String, requestOptions: RequestOptions): Invoice = + update(invoiceId, InvoiceUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all [`Invoice`](/core-concepts#invoice)s for an account in a * list format. @@ -81,7 +101,18 @@ interface InvoiceService { /** * This endpoint is used to fetch an [`Invoice`](/core-concepts#invoice) given an identifier. */ - fun fetch(params: InvoiceFetchParams): Invoice = fetch(params, RequestOptions.none()) + fun fetch(invoiceId: String): Invoice = fetch(invoiceId, InvoiceFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Invoice = fetch(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch(invoiceId: String, params: InvoiceFetchParams = InvoiceFetchParams.none()): Invoice = + fetch(invoiceId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -89,6 +120,13 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): Invoice + /** @see [fetch] */ + fun fetch(params: InvoiceFetchParams): Invoice = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(invoiceId: String, requestOptions: RequestOptions): Invoice = + fetch(invoiceId, InvoiceFetchParams.none(), requestOptions) + /** * This endpoint can be used to fetch the upcoming [invoice](/core-concepts#invoice) for the * current billing period given a subscription. @@ -109,7 +147,18 @@ interface InvoiceService { * could be customer-visible (e.g. sending emails, auto-collecting payment, syncing the invoice * to external providers, etc). */ - fun issue(params: InvoiceIssueParams): Invoice = issue(params, RequestOptions.none()) + fun issue(invoiceId: String): Invoice = issue(invoiceId, InvoiceIssueParams.none()) + + /** @see [issue] */ + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Invoice = issue(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [issue] */ + fun issue(invoiceId: String, params: InvoiceIssueParams = InvoiceIssueParams.none()): Invoice = + issue(invoiceId, params, RequestOptions.none()) /** @see [issue] */ fun issue( @@ -117,10 +166,28 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): Invoice + /** @see [issue] */ + fun issue(params: InvoiceIssueParams): Invoice = issue(params, RequestOptions.none()) + + /** @see [issue] */ + fun issue(invoiceId: String, requestOptions: RequestOptions): Invoice = + issue(invoiceId, InvoiceIssueParams.none(), requestOptions) + /** * This endpoint allows an invoice's status to be set the `paid` status. This can only be done * to invoices that are in the `issued` status. */ + fun markPaid(invoiceId: String, params: InvoiceMarkPaidParams): Invoice = + markPaid(invoiceId, params, RequestOptions.none()) + + /** @see [markPaid] */ + fun markPaid( + invoiceId: String, + params: InvoiceMarkPaidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Invoice = markPaid(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [markPaid] */ fun markPaid(params: InvoiceMarkPaidParams): Invoice = markPaid(params, RequestOptions.none()) /** @see [markPaid] */ @@ -133,7 +200,18 @@ interface InvoiceService { * This endpoint collects payment for an invoice using the customer's default payment method. * This action can only be taken on invoices with status "issued". */ - fun pay(params: InvoicePayParams): Invoice = pay(params, RequestOptions.none()) + fun pay(invoiceId: String): Invoice = pay(invoiceId, InvoicePayParams.none()) + + /** @see [pay] */ + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Invoice = pay(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [pay] */ + fun pay(invoiceId: String, params: InvoicePayParams = InvoicePayParams.none()): Invoice = + pay(invoiceId, params, RequestOptions.none()) /** @see [pay] */ fun pay( @@ -141,6 +219,13 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): Invoice + /** @see [pay] */ + fun pay(params: InvoicePayParams): Invoice = pay(params, RequestOptions.none()) + + /** @see [pay] */ + fun pay(invoiceId: String, requestOptions: RequestOptions): Invoice = + pay(invoiceId, InvoicePayParams.none(), requestOptions) + /** * This endpoint allows an invoice's status to be set the `void` status. This can only be done * to invoices that are in the `issued` status. @@ -153,8 +238,21 @@ interface InvoiceService { * credit block will be voided. If the invoice was created due to a top-up, the top-up will be * disabled. */ - fun voidInvoice(params: InvoiceVoidInvoiceParams): Invoice = - voidInvoice(params, RequestOptions.none()) + fun voidInvoice(invoiceId: String): Invoice = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none()) + + /** @see [voidInvoice] */ + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Invoice = voidInvoice(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [voidInvoice] */ + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + ): Invoice = voidInvoice(invoiceId, params, RequestOptions.none()) /** @see [voidInvoice] */ fun voidInvoice( @@ -162,6 +260,14 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): Invoice + /** @see [voidInvoice] */ + fun voidInvoice(params: InvoiceVoidInvoiceParams): Invoice = + voidInvoice(params, RequestOptions.none()) + + /** @see [voidInvoice] */ + fun voidInvoice(invoiceId: String, requestOptions: RequestOptions): Invoice = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none(), requestOptions) + /** A view of [InvoiceService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -185,8 +291,24 @@ interface InvoiceService { * as [InvoiceService.update]. */ @MustBeClosed - fun update(params: InvoiceUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(invoiceId: String): HttpResponseFor = + update(invoiceId, InvoiceUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + invoiceId: String, + params: InvoiceUpdateParams = InvoiceUpdateParams.none(), + ): HttpResponseFor = update(invoiceId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -195,6 +317,16 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: InvoiceUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update(invoiceId: String, requestOptions: RequestOptions): HttpResponseFor = + update(invoiceId, InvoiceUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /invoices`, but is otherwise the same as * [InvoiceService.list]. @@ -224,8 +356,24 @@ interface InvoiceService { * as [InvoiceService.fetch]. */ @MustBeClosed - fun fetch(params: InvoiceFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(invoiceId: String): HttpResponseFor = + fetch(invoiceId, InvoiceFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + invoiceId: String, + params: InvoiceFetchParams = InvoiceFetchParams.none(), + ): HttpResponseFor = fetch(invoiceId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -234,6 +382,16 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: InvoiceFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(invoiceId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(invoiceId, InvoiceFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /invoices/upcoming`, but is otherwise the same as * [InvoiceService.fetchUpcoming]. @@ -256,8 +414,24 @@ interface InvoiceService { * same as [InvoiceService.issue]. */ @MustBeClosed - fun issue(params: InvoiceIssueParams): HttpResponseFor = - issue(params, RequestOptions.none()) + fun issue(invoiceId: String): HttpResponseFor = + issue(invoiceId, InvoiceIssueParams.none()) + + /** @see [issue] */ + @MustBeClosed + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + issue(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [issue] */ + @MustBeClosed + fun issue( + invoiceId: String, + params: InvoiceIssueParams = InvoiceIssueParams.none(), + ): HttpResponseFor = issue(invoiceId, params, RequestOptions.none()) /** @see [issue] */ @MustBeClosed @@ -266,11 +440,35 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [issue] */ + @MustBeClosed + fun issue(params: InvoiceIssueParams): HttpResponseFor = + issue(params, RequestOptions.none()) + + /** @see [issue] */ + @MustBeClosed + fun issue(invoiceId: String, requestOptions: RequestOptions): HttpResponseFor = + issue(invoiceId, InvoiceIssueParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /invoices/{invoice_id}/mark_paid`, but is otherwise * the same as [InvoiceService.markPaid]. */ @MustBeClosed + fun markPaid(invoiceId: String, params: InvoiceMarkPaidParams): HttpResponseFor = + markPaid(invoiceId, params, RequestOptions.none()) + + /** @see [markPaid] */ + @MustBeClosed + fun markPaid( + invoiceId: String, + params: InvoiceMarkPaidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + markPaid(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [markPaid] */ + @MustBeClosed fun markPaid(params: InvoiceMarkPaidParams): HttpResponseFor = markPaid(params, RequestOptions.none()) @@ -286,8 +484,24 @@ interface InvoiceService { * same as [InvoiceService.pay]. */ @MustBeClosed - fun pay(params: InvoicePayParams): HttpResponseFor = - pay(params, RequestOptions.none()) + fun pay(invoiceId: String): HttpResponseFor = + pay(invoiceId, InvoicePayParams.none()) + + /** @see [pay] */ + @MustBeClosed + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + pay(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [pay] */ + @MustBeClosed + fun pay( + invoiceId: String, + params: InvoicePayParams = InvoicePayParams.none(), + ): HttpResponseFor = pay(invoiceId, params, RequestOptions.none()) /** @see [pay] */ @MustBeClosed @@ -296,13 +510,39 @@ interface InvoiceService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [pay] */ + @MustBeClosed + fun pay(params: InvoicePayParams): HttpResponseFor = + pay(params, RequestOptions.none()) + + /** @see [pay] */ + @MustBeClosed + fun pay(invoiceId: String, requestOptions: RequestOptions): HttpResponseFor = + pay(invoiceId, InvoicePayParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /invoices/{invoice_id}/void`, but is otherwise the * same as [InvoiceService.voidInvoice]. */ @MustBeClosed - fun voidInvoice(params: InvoiceVoidInvoiceParams): HttpResponseFor = - voidInvoice(params, RequestOptions.none()) + fun voidInvoice(invoiceId: String): HttpResponseFor = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none()) + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + voidInvoice(params.toBuilder().invoiceId(invoiceId).build(), requestOptions) + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice( + invoiceId: String, + params: InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams.none(), + ): HttpResponseFor = voidInvoice(invoiceId, params, RequestOptions.none()) /** @see [voidInvoice] */ @MustBeClosed @@ -310,5 +550,18 @@ interface InvoiceService { params: InvoiceVoidInvoiceParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice(params: InvoiceVoidInvoiceParams): HttpResponseFor = + voidInvoice(params, RequestOptions.none()) + + /** @see [voidInvoice] */ + @MustBeClosed + fun voidInvoice( + invoiceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + voidInvoice(invoiceId, InvoiceVoidInvoiceParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceServiceImpl.kt index 9ca3b288d..54c0dc6c1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -28,6 +29,7 @@ import com.withorb.api.models.InvoiceMarkPaidParams import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams +import kotlin.jvm.optionals.getOrNull class InvoiceServiceImpl internal constructor(private val clientOptions: ClientOptions) : InvoiceService { @@ -119,6 +121,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO params: InvoiceUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -180,6 +185,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO params: InvoiceFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -233,6 +241,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO params: InvoiceIssueParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -260,6 +271,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO params: InvoiceMarkPaidParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -287,6 +301,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO params: InvoicePayParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -314,6 +331,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO params: InvoiceVoidInvoiceParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("invoiceId", params.invoiceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemService.kt index df39426fd..86faa1fdc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemService.kt @@ -29,7 +29,18 @@ interface ItemService { ): Item /** This endpoint can be used to update properties on the Item. */ - fun update(params: ItemUpdateParams): Item = update(params, RequestOptions.none()) + fun update(itemId: String): Item = update(itemId, ItemUpdateParams.none()) + + /** @see [update] */ + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Item = update(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [update] */ + fun update(itemId: String, params: ItemUpdateParams = ItemUpdateParams.none()): Item = + update(itemId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -37,6 +48,13 @@ interface ItemService { requestOptions: RequestOptions = RequestOptions.none(), ): Item + /** @see [update] */ + fun update(params: ItemUpdateParams): Item = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(itemId: String, requestOptions: RequestOptions): Item = + update(itemId, ItemUpdateParams.none(), requestOptions) + /** This endpoint returns a list of all Items, ordered in descending order by creation time. */ fun list(): ItemListPage = list(ItemListParams.none()) @@ -55,11 +73,29 @@ interface ItemService { list(ItemListParams.none(), requestOptions) /** This endpoint returns an item identified by its item_id. */ - fun fetch(params: ItemFetchParams): Item = fetch(params, RequestOptions.none()) + fun fetch(itemId: String): Item = fetch(itemId, ItemFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Item = fetch(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch(itemId: String, params: ItemFetchParams = ItemFetchParams.none()): Item = + fetch(itemId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch(params: ItemFetchParams, requestOptions: RequestOptions = RequestOptions.none()): Item + /** @see [fetch] */ + fun fetch(params: ItemFetchParams): Item = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(itemId: String, requestOptions: RequestOptions): Item = + fetch(itemId, ItemFetchParams.none(), requestOptions) + /** A view of [ItemService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -83,8 +119,22 @@ interface ItemService { * [ItemService.update]. */ @MustBeClosed - fun update(params: ItemUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(itemId: String): HttpResponseFor = update(itemId, ItemUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = update(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + itemId: String, + params: ItemUpdateParams = ItemUpdateParams.none(), + ): HttpResponseFor = update(itemId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -93,6 +143,16 @@ interface ItemService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: ItemUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update(itemId: String, requestOptions: RequestOptions): HttpResponseFor = + update(itemId, ItemUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /items`, but is otherwise the same as * [ItemService.list]. @@ -121,8 +181,22 @@ interface ItemService { * [ItemService.fetch]. */ @MustBeClosed - fun fetch(params: ItemFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(itemId: String): HttpResponseFor = fetch(itemId, ItemFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = fetch(params.toBuilder().itemId(itemId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + itemId: String, + params: ItemFetchParams = ItemFetchParams.none(), + ): HttpResponseFor = fetch(itemId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -130,5 +204,15 @@ interface ItemService { params: ItemFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: ItemFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(itemId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(itemId, ItemFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemServiceImpl.kt index 04065b321..a0a44bbb4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/ItemServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -22,6 +23,7 @@ import com.withorb.api.models.ItemListPage import com.withorb.api.models.ItemListPageResponse import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams +import kotlin.jvm.optionals.getOrNull class ItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : ItemService { @@ -86,6 +88,9 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti params: ItemUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("itemId", params.itemId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -147,6 +152,9 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti params: ItemFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("itemId", params.itemId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricService.kt index 9042fb363..9c207ddb8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricService.kt @@ -36,7 +36,20 @@ interface MetricService { * This endpoint allows you to update the `metadata` property on a metric. If you pass `null` * for the metadata value, it will clear any existing metadata for that invoice. */ - fun update(params: MetricUpdateParams): BillableMetric = update(params, RequestOptions.none()) + fun update(metricId: String): BillableMetric = update(metricId, MetricUpdateParams.none()) + + /** @see [update] */ + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): BillableMetric = update(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [update] */ + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + ): BillableMetric = update(metricId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -44,6 +57,13 @@ interface MetricService { requestOptions: RequestOptions = RequestOptions.none(), ): BillableMetric + /** @see [update] */ + fun update(params: MetricUpdateParams): BillableMetric = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(metricId: String, requestOptions: RequestOptions): BillableMetric = + update(metricId, MetricUpdateParams.none(), requestOptions) + /** * This endpoint is used to fetch [metric](/core-concepts##metric) details given a metric * identifier. It returns information about the metrics including its name, description, and @@ -69,7 +89,20 @@ interface MetricService { * This endpoint is used to list [metrics](/core-concepts#metric). It returns information about * the metrics including its name, description, and item. */ - fun fetch(params: MetricFetchParams): BillableMetric = fetch(params, RequestOptions.none()) + fun fetch(metricId: String): BillableMetric = fetch(metricId, MetricFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): BillableMetric = fetch(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + ): BillableMetric = fetch(metricId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -77,6 +110,13 @@ interface MetricService { requestOptions: RequestOptions = RequestOptions.none(), ): BillableMetric + /** @see [fetch] */ + fun fetch(params: MetricFetchParams): BillableMetric = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(metricId: String, requestOptions: RequestOptions): BillableMetric = + fetch(metricId, MetricFetchParams.none(), requestOptions) + /** A view of [MetricService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -100,8 +140,24 @@ interface MetricService { * [MetricService.update]. */ @MustBeClosed - fun update(params: MetricUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(metricId: String): HttpResponseFor = + update(metricId, MetricUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + metricId: String, + params: MetricUpdateParams = MetricUpdateParams.none(), + ): HttpResponseFor = update(metricId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -110,6 +166,19 @@ interface MetricService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: MetricUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + metricId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(metricId, MetricUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /metrics`, but is otherwise the same as * [MetricService.list]. @@ -139,8 +208,24 @@ interface MetricService { * [MetricService.fetch]. */ @MustBeClosed - fun fetch(params: MetricFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(metricId: String): HttpResponseFor = + fetch(metricId, MetricFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().metricId(metricId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + metricId: String, + params: MetricFetchParams = MetricFetchParams.none(), + ): HttpResponseFor = fetch(metricId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -148,5 +233,18 @@ interface MetricService { params: MetricFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: MetricFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + metricId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetch(metricId, MetricFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricServiceImpl.kt index cc6119c69..94d03141e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/MetricServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -22,6 +23,7 @@ import com.withorb.api.models.MetricListPage import com.withorb.api.models.MetricListPageResponse import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams +import kotlin.jvm.optionals.getOrNull class MetricServiceImpl internal constructor(private val clientOptions: ClientOptions) : MetricService { @@ -93,6 +95,9 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp params: MetricUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("metricId", params.metricId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -154,6 +159,9 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp params: MetricFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("metricId", params.metricId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanService.kt index 95f39fad9..ea3405d58 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanService.kt @@ -37,7 +37,18 @@ interface PlanService { * * Other fields on a customer are currently immutable. */ - fun update(params: PlanUpdateParams): Plan = update(params, RequestOptions.none()) + fun update(planId: String): Plan = update(planId, PlanUpdateParams.none()) + + /** @see [update] */ + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Plan = update(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [update] */ + fun update(planId: String, params: PlanUpdateParams = PlanUpdateParams.none()): Plan = + update(planId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -45,6 +56,13 @@ interface PlanService { requestOptions: RequestOptions = RequestOptions.none(), ): Plan + /** @see [update] */ + fun update(params: PlanUpdateParams): Plan = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(planId: String, requestOptions: RequestOptions): Plan = + update(planId, PlanUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all [plans](/core-concepts#plan-and-price) for an account in * a list format. The list of plans is ordered starting from the most recently created plan. The @@ -85,11 +103,29 @@ interface PlanService { * Orb supports plan phases, also known as contract ramps. For plans with phases, the serialized * prices refer to all prices across all phases. */ - fun fetch(params: PlanFetchParams): Plan = fetch(params, RequestOptions.none()) + fun fetch(planId: String): Plan = fetch(planId, PlanFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Plan = fetch(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch(planId: String, params: PlanFetchParams = PlanFetchParams.none()): Plan = + fetch(planId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch(params: PlanFetchParams, requestOptions: RequestOptions = RequestOptions.none()): Plan + /** @see [fetch] */ + fun fetch(params: PlanFetchParams): Plan = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(planId: String, requestOptions: RequestOptions): Plan = + fetch(planId, PlanFetchParams.none(), requestOptions) + /** A view of [PlanService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -115,8 +151,22 @@ interface PlanService { * [PlanService.update]. */ @MustBeClosed - fun update(params: PlanUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(planId: String): HttpResponseFor = update(planId, PlanUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = update(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + planId: String, + params: PlanUpdateParams = PlanUpdateParams.none(), + ): HttpResponseFor = update(planId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -125,6 +175,16 @@ interface PlanService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: PlanUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update(planId: String, requestOptions: RequestOptions): HttpResponseFor = + update(planId, PlanUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /plans`, but is otherwise the same as * [PlanService.list]. @@ -153,8 +213,22 @@ interface PlanService { * [PlanService.fetch]. */ @MustBeClosed - fun fetch(params: PlanFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(planId: String): HttpResponseFor = fetch(planId, PlanFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = fetch(params.toBuilder().planId(planId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + planId: String, + params: PlanFetchParams = PlanFetchParams.none(), + ): HttpResponseFor = fetch(planId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -162,5 +236,15 @@ interface PlanService { params: PlanFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PlanFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(planId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(planId, PlanFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanServiceImpl.kt index a817592dc..ed66bd0cb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PlanServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -24,6 +25,7 @@ import com.withorb.api.models.PlanListParams import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.blocking.plans.ExternalPlanIdService import com.withorb.api.services.blocking.plans.ExternalPlanIdServiceImpl +import kotlin.jvm.optionals.getOrNull class PlanServiceImpl internal constructor(private val clientOptions: ClientOptions) : PlanService { @@ -100,6 +102,9 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti params: PlanUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("planId", params.planId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -161,6 +166,9 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti params: PlanFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("planId", params.planId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceService.kt index 1648965ac..1718a42e4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceService.kt @@ -48,7 +48,18 @@ interface PriceService { * This endpoint allows you to update the `metadata` property on a price. If you pass null for * the metadata value, it will clear any existing metadata for that price. */ - fun update(params: PriceUpdateParams): Price = update(params, RequestOptions.none()) + fun update(priceId: String): Price = update(priceId, PriceUpdateParams.none()) + + /** @see [update] */ + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Price = update(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [update] */ + fun update(priceId: String, params: PriceUpdateParams = PriceUpdateParams.none()): Price = + update(priceId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -56,6 +67,13 @@ interface PriceService { requestOptions: RequestOptions = RequestOptions.none(), ): Price + /** @see [update] */ + fun update(params: PriceUpdateParams): Price = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(priceId: String, requestOptions: RequestOptions): Price = + update(priceId, PriceUpdateParams.none(), requestOptions) + /** * This endpoint is used to list all add-on prices created using the * [price creation endpoint](/api-reference/price/create-price). @@ -95,6 +113,17 @@ interface PriceService { * the results must be no greater than 1000. Note that this is a POST endpoint rather than a GET * endpoint because it employs a JSON body rather than query parameters. */ + fun evaluate(priceId: String, params: PriceEvaluateParams): PriceEvaluateResponse = + evaluate(priceId, params, RequestOptions.none()) + + /** @see [evaluate] */ + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): PriceEvaluateResponse = evaluate(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [evaluate] */ fun evaluate(params: PriceEvaluateParams): PriceEvaluateResponse = evaluate(params, RequestOptions.none()) @@ -105,7 +134,18 @@ interface PriceService { ): PriceEvaluateResponse /** This endpoint returns a price given an identifier. */ - fun fetch(params: PriceFetchParams): Price = fetch(params, RequestOptions.none()) + fun fetch(priceId: String): Price = fetch(priceId, PriceFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Price = fetch(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch(priceId: String, params: PriceFetchParams = PriceFetchParams.none()): Price = + fetch(priceId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -113,6 +153,13 @@ interface PriceService { requestOptions: RequestOptions = RequestOptions.none(), ): Price + /** @see [fetch] */ + fun fetch(params: PriceFetchParams): Price = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(priceId: String, requestOptions: RequestOptions): Price = + fetch(priceId, PriceFetchParams.none(), requestOptions) + /** A view of [PriceService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -138,8 +185,24 @@ interface PriceService { * [PriceService.update]. */ @MustBeClosed - fun update(params: PriceUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(priceId: String): HttpResponseFor = + update(priceId, PriceUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + priceId: String, + params: PriceUpdateParams = PriceUpdateParams.none(), + ): HttpResponseFor = update(priceId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -148,6 +211,16 @@ interface PriceService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: PriceUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update(priceId: String, requestOptions: RequestOptions): HttpResponseFor = + update(priceId, PriceUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /prices`, but is otherwise the same as * [PriceService.list]. @@ -176,6 +249,22 @@ interface PriceService { * same as [PriceService.evaluate]. */ @MustBeClosed + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + ): HttpResponseFor = evaluate(priceId, params, RequestOptions.none()) + + /** @see [evaluate] */ + @MustBeClosed + fun evaluate( + priceId: String, + params: PriceEvaluateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + evaluate(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [evaluate] */ + @MustBeClosed fun evaluate(params: PriceEvaluateParams): HttpResponseFor = evaluate(params, RequestOptions.none()) @@ -191,8 +280,23 @@ interface PriceService { * [PriceService.fetch]. */ @MustBeClosed - fun fetch(params: PriceFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(priceId: String): HttpResponseFor = fetch(priceId, PriceFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().priceId(priceId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + priceId: String, + params: PriceFetchParams = PriceFetchParams.none(), + ): HttpResponseFor = fetch(priceId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -200,5 +304,15 @@ interface PriceService { params: PriceFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PriceFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(priceId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(priceId, PriceFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceServiceImpl.kt index 556cb014d..5f89789b6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/PriceServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -26,6 +27,7 @@ import com.withorb.api.models.PriceListParams import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.blocking.prices.ExternalPriceIdService import com.withorb.api.services.blocking.prices.ExternalPriceIdServiceImpl +import kotlin.jvm.optionals.getOrNull class PriceServiceImpl internal constructor(private val clientOptions: ClientOptions) : PriceService { @@ -110,6 +112,9 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt params: PriceUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("priceId", params.priceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -172,6 +177,9 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt params: PriceEvaluateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("priceId", params.priceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -199,6 +207,9 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt params: PriceFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("priceId", params.priceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt index 13946e44c..42a2deff9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt @@ -29,8 +29,26 @@ interface SubscriptionChangeService { * subscription change will be referenced by the `pending_subscription_change` field in the * response. */ - fun retrieve(params: SubscriptionChangeRetrieveParams): SubscriptionChangeRetrieveResponse = - retrieve(params, RequestOptions.none()) + fun retrieve(subscriptionChangeId: String): SubscriptionChangeRetrieveResponse = + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionChangeRetrieveResponse = + retrieve( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + ): SubscriptionChangeRetrieveResponse = + retrieve(subscriptionChangeId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -38,13 +56,38 @@ interface SubscriptionChangeService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionChangeRetrieveResponse + /** @see [retrieve] */ + fun retrieve(params: SubscriptionChangeRetrieveParams): SubscriptionChangeRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): SubscriptionChangeRetrieveResponse = + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none(), requestOptions) + /** * Apply a subscription change to perform the intended action. If a positive amount is passed * with a request to this endpoint, any eligible invoices that were created will be issued * immediately if they only contain in-advance fees. */ - fun apply(params: SubscriptionChangeApplyParams): SubscriptionChangeApplyResponse = - apply(params, RequestOptions.none()) + fun apply(subscriptionChangeId: String): SubscriptionChangeApplyResponse = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none()) + + /** @see [apply] */ + fun apply( + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionChangeApplyResponse = + apply(params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), requestOptions) + + /** @see [apply] */ + fun apply( + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + ): SubscriptionChangeApplyResponse = apply(subscriptionChangeId, params, RequestOptions.none()) /** @see [apply] */ fun apply( @@ -52,13 +95,42 @@ interface SubscriptionChangeService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionChangeApplyResponse + /** @see [apply] */ + fun apply(params: SubscriptionChangeApplyParams): SubscriptionChangeApplyResponse = + apply(params, RequestOptions.none()) + + /** @see [apply] */ + fun apply( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): SubscriptionChangeApplyResponse = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none(), requestOptions) + /** * Cancel a subscription change. The change can no longer be applied. A subscription can only * have one "pending" change at a time - use this endpoint to cancel an existing change before * creating a new one. */ - fun cancel(params: SubscriptionChangeCancelParams): SubscriptionChangeCancelResponse = - cancel(params, RequestOptions.none()) + fun cancel(subscriptionChangeId: String): SubscriptionChangeCancelResponse = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none()) + + /** @see [cancel] */ + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionChangeCancelResponse = + cancel( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [cancel] */ + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + ): SubscriptionChangeCancelResponse = + cancel(subscriptionChangeId, params, RequestOptions.none()) /** @see [cancel] */ fun cancel( @@ -66,6 +138,17 @@ interface SubscriptionChangeService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionChangeCancelResponse + /** @see [cancel] */ + fun cancel(params: SubscriptionChangeCancelParams): SubscriptionChangeCancelResponse = + cancel(params, RequestOptions.none()) + + /** @see [cancel] */ + fun cancel( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): SubscriptionChangeCancelResponse = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none(), requestOptions) + /** * A view of [SubscriptionChangeService] that provides access to raw HTTP responses for each * method. @@ -78,9 +161,29 @@ interface SubscriptionChangeService { */ @MustBeClosed fun retrieve( - params: SubscriptionChangeRetrieveParams + subscriptionChangeId: String ): HttpResponseFor = - retrieve(params, RequestOptions.none()) + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + subscriptionChangeId: String, + params: SubscriptionChangeRetrieveParams = SubscriptionChangeRetrieveParams.none(), + ): HttpResponseFor = + retrieve(subscriptionChangeId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -89,15 +192,49 @@ interface SubscriptionChangeService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: SubscriptionChangeRetrieveParams + ): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(subscriptionChangeId, SubscriptionChangeRetrieveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscription_changes/{subscription_change_id}/apply`, but is otherwise the same as * [SubscriptionChangeService.apply]. */ @MustBeClosed + fun apply(subscriptionChangeId: String): HttpResponseFor = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none()) + + /** @see [apply] */ + @MustBeClosed fun apply( - params: SubscriptionChangeApplyParams - ): HttpResponseFor = apply(params, RequestOptions.none()) + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + apply( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [apply] */ + @MustBeClosed + fun apply( + subscriptionChangeId: String, + params: SubscriptionChangeApplyParams = SubscriptionChangeApplyParams.none(), + ): HttpResponseFor = + apply(subscriptionChangeId, params, RequestOptions.none()) /** @see [apply] */ @MustBeClosed @@ -106,6 +243,20 @@ interface SubscriptionChangeService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [apply] */ + @MustBeClosed + fun apply( + params: SubscriptionChangeApplyParams + ): HttpResponseFor = apply(params, RequestOptions.none()) + + /** @see [apply] */ + @MustBeClosed + fun apply( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + apply(subscriptionChangeId, SubscriptionChangeApplyParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscription_changes/{subscription_change_id}/cancel`, but is otherwise the same as @@ -113,8 +264,29 @@ interface SubscriptionChangeService { */ @MustBeClosed fun cancel( - params: SubscriptionChangeCancelParams - ): HttpResponseFor = cancel(params, RequestOptions.none()) + subscriptionChangeId: String + ): HttpResponseFor = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none()) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + cancel( + params.toBuilder().subscriptionChangeId(subscriptionChangeId).build(), + requestOptions, + ) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionChangeId: String, + params: SubscriptionChangeCancelParams = SubscriptionChangeCancelParams.none(), + ): HttpResponseFor = + cancel(subscriptionChangeId, params, RequestOptions.none()) /** @see [cancel] */ @MustBeClosed @@ -122,5 +294,19 @@ interface SubscriptionChangeService { params: SubscriptionChangeCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + params: SubscriptionChangeCancelParams + ): HttpResponseFor = cancel(params, RequestOptions.none()) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionChangeId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + cancel(subscriptionChangeId, SubscriptionChangeCancelParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt index 87fd88582..b103be4af 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -21,6 +22,7 @@ import com.withorb.api.models.SubscriptionChangeCancelParams import com.withorb.api.models.SubscriptionChangeCancelResponse import com.withorb.api.models.SubscriptionChangeRetrieveParams import com.withorb.api.models.SubscriptionChangeRetrieveResponse +import kotlin.jvm.optionals.getOrNull class SubscriptionChangeServiceImpl internal constructor(private val clientOptions: ClientOptions) : SubscriptionChangeService { @@ -65,6 +67,9 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio params: SubscriptionChangeRetrieveParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionChangeId", params.subscriptionChangeId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -92,6 +97,9 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio params: SubscriptionChangeApplyParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionChangeId", params.subscriptionChangeId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -120,6 +128,9 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio params: SubscriptionChangeCancelParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionChangeId", params.subscriptionChangeId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt index b8ea48c36..337953b2a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt @@ -303,8 +303,22 @@ interface SubscriptionService { * This endpoint can be used to update the `metadata`, `net terms`, `auto_collection`, * `invoicing_threshold`, and `default_invoice_memo` properties on a subscription. */ - fun update(params: SubscriptionUpdateParams): Subscription = - update(params, RequestOptions.none()) + fun update(subscriptionId: String): Subscription = + update(subscriptionId, SubscriptionUpdateParams.none()) + + /** @see [update] */ + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Subscription = + update(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [update] */ + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + ): Subscription = update(subscriptionId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -312,6 +326,14 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): Subscription + /** @see [update] */ + fun update(params: SubscriptionUpdateParams): Subscription = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(subscriptionId: String, requestOptions: RequestOptions): Subscription = + update(subscriptionId, SubscriptionUpdateParams.none(), requestOptions) + /** * This endpoint returns a list of all subscriptions for an account as a * [paginated](/api-reference/pagination) list, ordered starting from the most recently created @@ -391,6 +413,20 @@ interface SubscriptionService { * invoice and generate a new one based on the new dates for the subscription. See the section * on [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors). */ + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + ): SubscriptionCancelResponse = cancel(subscriptionId, params, RequestOptions.none()) + + /** @see [cancel] */ + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionCancelResponse = + cancel(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [cancel] */ fun cancel(params: SubscriptionCancelParams): SubscriptionCancelResponse = cancel(params, RequestOptions.none()) @@ -404,7 +440,22 @@ interface SubscriptionService { * This endpoint is used to fetch a [Subscription](/core-concepts##subscription) given an * identifier. */ - fun fetch(params: SubscriptionFetchParams): Subscription = fetch(params, RequestOptions.none()) + fun fetch(subscriptionId: String): Subscription = + fetch(subscriptionId, SubscriptionFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Subscription = + fetch(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + ): Subscription = fetch(subscriptionId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -412,6 +463,13 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): Subscription + /** @see [fetch] */ + fun fetch(params: SubscriptionFetchParams): Subscription = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(subscriptionId: String, requestOptions: RequestOptions): Subscription = + fetch(subscriptionId, SubscriptionFetchParams.none(), requestOptions) + /** * This endpoint is used to fetch a day-by-day snapshot of a subscription's costs in Orb, * calculated by applying pricing information to the underlying usage (see the @@ -423,8 +481,22 @@ interface SubscriptionService { * of costs to a specific subscription for the customer (e.g. to de-aggregate costs when a * customer's subscription has started and stopped on the same day). */ - fun fetchCosts(params: SubscriptionFetchCostsParams): SubscriptionFetchCostsResponse = - fetchCosts(params, RequestOptions.none()) + fun fetchCosts(subscriptionId: String): SubscriptionFetchCostsResponse = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none()) + + /** @see [fetchCosts] */ + fun fetchCosts( + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionFetchCostsResponse = + fetchCosts(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchCosts] */ + fun fetchCosts( + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + ): SubscriptionFetchCostsResponse = fetchCosts(subscriptionId, params, RequestOptions.none()) /** @see [fetchCosts] */ fun fetchCosts( @@ -432,13 +504,38 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionFetchCostsResponse + /** @see [fetchCosts] */ + fun fetchCosts(params: SubscriptionFetchCostsParams): SubscriptionFetchCostsResponse = + fetchCosts(params, RequestOptions.none()) + + /** @see [fetchCosts] */ + fun fetchCosts( + subscriptionId: String, + requestOptions: RequestOptions, + ): SubscriptionFetchCostsResponse = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none(), requestOptions) + /** * This endpoint returns a [paginated](/api-reference/pagination) list of all plans associated * with a subscription along with their start and end dates. This list contains the * subscription's initial plan along with past and future plan changes. */ - fun fetchSchedule(params: SubscriptionFetchScheduleParams): SubscriptionFetchSchedulePage = - fetchSchedule(params, RequestOptions.none()) + fun fetchSchedule(subscriptionId: String): SubscriptionFetchSchedulePage = + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none()) + + /** @see [fetchSchedule] */ + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionFetchSchedulePage = + fetchSchedule(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchSchedule] */ + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + ): SubscriptionFetchSchedulePage = fetchSchedule(subscriptionId, params, RequestOptions.none()) /** @see [fetchSchedule] */ fun fetchSchedule( @@ -446,6 +543,17 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionFetchSchedulePage + /** @see [fetchSchedule] */ + fun fetchSchedule(params: SubscriptionFetchScheduleParams): SubscriptionFetchSchedulePage = + fetchSchedule(params, RequestOptions.none()) + + /** @see [fetchSchedule] */ + fun fetchSchedule( + subscriptionId: String, + requestOptions: RequestOptions, + ): SubscriptionFetchSchedulePage = + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none(), requestOptions) + /** * This endpoint is used to fetch a subscription's usage in Orb. Especially when combined with * optional query parameters, this endpoint is a powerful way to build visualizations on top of @@ -623,8 +731,22 @@ interface SubscriptionService { * - `second_dimension_key`: `provider` * - `second_dimension_value`: `aws` */ - fun fetchUsage(params: SubscriptionFetchUsageParams): SubscriptionUsage = - fetchUsage(params, RequestOptions.none()) + fun fetchUsage(subscriptionId: String): SubscriptionUsage = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none()) + + /** @see [fetchUsage] */ + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionUsage = + fetchUsage(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchUsage] */ + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + ): SubscriptionUsage = fetchUsage(subscriptionId, params, RequestOptions.none()) /** @see [fetchUsage] */ fun fetchUsage( @@ -632,6 +754,14 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUsage + /** @see [fetchUsage] */ + fun fetchUsage(params: SubscriptionFetchUsageParams): SubscriptionUsage = + fetchUsage(params, RequestOptions.none()) + + /** @see [fetchUsage] */ + fun fetchUsage(subscriptionId: String, requestOptions: RequestOptions): SubscriptionUsage = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none(), requestOptions) + /** * This endpoint is used to add and edit subscription * [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By making @@ -699,9 +829,23 @@ interface SubscriptionService { * using the `fixed_fee_quantity_transitions` property on a subscription’s serialized price * intervals. */ + fun priceIntervals(subscriptionId: String): SubscriptionPriceIntervalsResponse = + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none()) + + /** @see [priceIntervals] */ fun priceIntervals( - params: SubscriptionPriceIntervalsParams - ): SubscriptionPriceIntervalsResponse = priceIntervals(params, RequestOptions.none()) + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionPriceIntervalsResponse = + priceIntervals(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [priceIntervals] */ + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + ): SubscriptionPriceIntervalsResponse = + priceIntervals(subscriptionId, params, RequestOptions.none()) /** @see [priceIntervals] */ fun priceIntervals( @@ -709,6 +853,18 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionPriceIntervalsResponse + /** @see [priceIntervals] */ + fun priceIntervals( + params: SubscriptionPriceIntervalsParams + ): SubscriptionPriceIntervalsResponse = priceIntervals(params, RequestOptions.none()) + + /** @see [priceIntervals] */ + fun priceIntervals( + subscriptionId: String, + requestOptions: RequestOptions, + ): SubscriptionPriceIntervalsResponse = + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none(), requestOptions) + /** * This endpoint can be used to change an existing subscription's plan. It returns the * serialized updated subscription object. @@ -875,6 +1031,24 @@ interface SubscriptionService { * change, adjusting the customer balance as needed. For details on this behavior, see * [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees). */ + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + ): SubscriptionSchedulePlanChangeResponse = + schedulePlanChange(subscriptionId, params, RequestOptions.none()) + + /** @see [schedulePlanChange] */ + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionSchedulePlanChangeResponse = + schedulePlanChange( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [schedulePlanChange] */ fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams ): SubscriptionSchedulePlanChangeResponse = schedulePlanChange(params, RequestOptions.none()) @@ -888,8 +1062,23 @@ interface SubscriptionService { /** * Manually trigger a phase, effective the given date (or the current time, if not specified). */ - fun triggerPhase(params: SubscriptionTriggerPhaseParams): SubscriptionTriggerPhaseResponse = - triggerPhase(params, RequestOptions.none()) + fun triggerPhase(subscriptionId: String): SubscriptionTriggerPhaseResponse = + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none()) + + /** @see [triggerPhase] */ + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionTriggerPhaseResponse = + triggerPhase(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [triggerPhase] */ + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + ): SubscriptionTriggerPhaseResponse = + triggerPhase(subscriptionId, params, RequestOptions.none()) /** @see [triggerPhase] */ fun triggerPhase( @@ -897,6 +1086,17 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionTriggerPhaseResponse + /** @see [triggerPhase] */ + fun triggerPhase(params: SubscriptionTriggerPhaseParams): SubscriptionTriggerPhaseResponse = + triggerPhase(params, RequestOptions.none()) + + /** @see [triggerPhase] */ + fun triggerPhase( + subscriptionId: String, + requestOptions: RequestOptions, + ): SubscriptionTriggerPhaseResponse = + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none(), requestOptions) + /** * This endpoint can be used to unschedule any pending cancellations for a subscription. * @@ -904,10 +1104,28 @@ interface SubscriptionService { * This operation will turn on auto-renew, ensuring that the subscription does not end at the * currently scheduled cancellation time. */ + fun unscheduleCancellation(subscriptionId: String): SubscriptionUnscheduleCancellationResponse = + unscheduleCancellation(subscriptionId, SubscriptionUnscheduleCancellationParams.none()) + + /** @see [unscheduleCancellation] */ fun unscheduleCancellation( - params: SubscriptionUnscheduleCancellationParams + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUnscheduleCancellationResponse = - unscheduleCancellation(params, RequestOptions.none()) + unscheduleCancellation( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + ): SubscriptionUnscheduleCancellationResponse = + unscheduleCancellation(subscriptionId, params, RequestOptions.none()) /** @see [unscheduleCancellation] */ fun unscheduleCancellation( @@ -915,12 +1133,47 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUnscheduleCancellationResponse + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + params: SubscriptionUnscheduleCancellationParams + ): SubscriptionUnscheduleCancellationResponse = + unscheduleCancellation(params, RequestOptions.none()) + + /** @see [unscheduleCancellation] */ + fun unscheduleCancellation( + subscriptionId: String, + requestOptions: RequestOptions, + ): SubscriptionUnscheduleCancellationResponse = + unscheduleCancellation( + subscriptionId, + SubscriptionUnscheduleCancellationParams.none(), + requestOptions, + ) + /** * This endpoint can be used to clear scheduled updates to the quantity for a fixed fee. * * If there are no updates scheduled, a request validation error will be returned with a 400 * status code. */ + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + ): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse = + unscheduleFixedFeeQuantityUpdates(subscriptionId, params, RequestOptions.none()) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse = + unscheduleFixedFeeQuantityUpdates( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams ): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse = @@ -936,9 +1189,32 @@ interface SubscriptionService { * This endpoint can be used to unschedule any pending plan changes on an existing subscription. */ fun unschedulePendingPlanChanges( - params: SubscriptionUnschedulePendingPlanChangesParams + subscriptionId: String ): SubscriptionUnschedulePendingPlanChangesResponse = - unschedulePendingPlanChanges(params, RequestOptions.none()) + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + ) + + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionUnschedulePendingPlanChangesResponse = + unschedulePendingPlanChanges( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + ): SubscriptionUnschedulePendingPlanChangesResponse = + unschedulePendingPlanChanges(subscriptionId, params, RequestOptions.none()) /** @see [unschedulePendingPlanChanges] */ fun unschedulePendingPlanChanges( @@ -946,6 +1222,23 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUnschedulePendingPlanChangesResponse + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + params: SubscriptionUnschedulePendingPlanChangesParams + ): SubscriptionUnschedulePendingPlanChangesResponse = + unschedulePendingPlanChanges(params, RequestOptions.none()) + + /** @see [unschedulePendingPlanChanges] */ + fun unschedulePendingPlanChanges( + subscriptionId: String, + requestOptions: RequestOptions, + ): SubscriptionUnschedulePendingPlanChangesResponse = + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions, + ) + /** * This endpoint can be used to update the quantity for a fixed fee. * @@ -960,6 +1253,24 @@ interface SubscriptionService { * If the fee is an in-advance fixed fee, it will also issue an immediate invoice for the * difference for the remainder of the billing period. */ + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + ): SubscriptionUpdateFixedFeeQuantityResponse = + updateFixedFeeQuantity(subscriptionId, params, RequestOptions.none()) + + /** @see [updateFixedFeeQuantity] */ + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionUpdateFixedFeeQuantityResponse = + updateFixedFeeQuantity( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [updateFixedFeeQuantity] */ fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams ): SubscriptionUpdateFixedFeeQuantityResponse = @@ -989,6 +1300,20 @@ interface SubscriptionService { * scheduled or an add-on price was added, that change will be pushed back by the same amount of * time the trial is extended). */ + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + ): SubscriptionUpdateTrialResponse = updateTrial(subscriptionId, params, RequestOptions.none()) + + /** @see [updateTrial] */ + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubscriptionUpdateTrialResponse = + updateTrial(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [updateTrial] */ fun updateTrial(params: SubscriptionUpdateTrialParams): SubscriptionUpdateTrialResponse = updateTrial(params, RequestOptions.none()) @@ -1034,8 +1359,24 @@ interface SubscriptionService { * the same as [SubscriptionService.update]. */ @MustBeClosed - fun update(params: SubscriptionUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(subscriptionId: String): HttpResponseFor = + update(subscriptionId, SubscriptionUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + subscriptionId: String, + params: SubscriptionUpdateParams = SubscriptionUpdateParams.none(), + ): HttpResponseFor = update(subscriptionId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -1044,6 +1385,19 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: SubscriptionUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(subscriptionId, SubscriptionUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions`, but is otherwise the same as * [SubscriptionService.list]. @@ -1074,6 +1428,23 @@ interface SubscriptionService { * otherwise the same as [SubscriptionService.cancel]. */ @MustBeClosed + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + ): HttpResponseFor = + cancel(subscriptionId, params, RequestOptions.none()) + + /** @see [cancel] */ + @MustBeClosed + fun cancel( + subscriptionId: String, + params: SubscriptionCancelParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + cancel(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [cancel] */ + @MustBeClosed fun cancel(params: SubscriptionCancelParams): HttpResponseFor = cancel(params, RequestOptions.none()) @@ -1089,8 +1460,24 @@ interface SubscriptionService { * the same as [SubscriptionService.fetch]. */ @MustBeClosed - fun fetch(params: SubscriptionFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(subscriptionId: String): HttpResponseFor = + fetch(subscriptionId, SubscriptionFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + subscriptionId: String, + params: SubscriptionFetchParams = SubscriptionFetchParams.none(), + ): HttpResponseFor = fetch(subscriptionId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -1099,15 +1486,43 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: SubscriptionFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetch(subscriptionId, SubscriptionFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions/{subscription_id}/costs`, but is * otherwise the same as [SubscriptionService.fetchCosts]. */ @MustBeClosed + fun fetchCosts(subscriptionId: String): HttpResponseFor = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none()) + + /** @see [fetchCosts] */ + @MustBeClosed fun fetchCosts( - params: SubscriptionFetchCostsParams + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor = - fetchCosts(params, RequestOptions.none()) + fetchCosts(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + subscriptionId: String, + params: SubscriptionFetchCostsParams = SubscriptionFetchCostsParams.none(), + ): HttpResponseFor = + fetchCosts(subscriptionId, params, RequestOptions.none()) /** @see [fetchCosts] */ @MustBeClosed @@ -1116,15 +1531,45 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + params: SubscriptionFetchCostsParams + ): HttpResponseFor = + fetchCosts(params, RequestOptions.none()) + + /** @see [fetchCosts] */ + @MustBeClosed + fun fetchCosts( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetchCosts(subscriptionId, SubscriptionFetchCostsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions/{subscription_id}/schedule`, but is * otherwise the same as [SubscriptionService.fetchSchedule]. */ @MustBeClosed + fun fetchSchedule(subscriptionId: String): HttpResponseFor = + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none()) + + /** @see [fetchSchedule] */ + @MustBeClosed fun fetchSchedule( - params: SubscriptionFetchScheduleParams + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor = - fetchSchedule(params, RequestOptions.none()) + fetchSchedule(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + subscriptionId: String, + params: SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams.none(), + ): HttpResponseFor = + fetchSchedule(subscriptionId, params, RequestOptions.none()) /** @see [fetchSchedule] */ @MustBeClosed @@ -1133,13 +1578,45 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + params: SubscriptionFetchScheduleParams + ): HttpResponseFor = + fetchSchedule(params, RequestOptions.none()) + + /** @see [fetchSchedule] */ + @MustBeClosed + fun fetchSchedule( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetchSchedule(subscriptionId, SubscriptionFetchScheduleParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /subscriptions/{subscription_id}/usage`, but is * otherwise the same as [SubscriptionService.fetchUsage]. */ @MustBeClosed - fun fetchUsage(params: SubscriptionFetchUsageParams): HttpResponseFor = - fetchUsage(params, RequestOptions.none()) + fun fetchUsage(subscriptionId: String): HttpResponseFor = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none()) + + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetchUsage(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + subscriptionId: String, + params: SubscriptionFetchUsageParams = SubscriptionFetchUsageParams.none(), + ): HttpResponseFor = + fetchUsage(subscriptionId, params, RequestOptions.none()) /** @see [fetchUsage] */ @MustBeClosed @@ -1148,15 +1625,48 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage(params: SubscriptionFetchUsageParams): HttpResponseFor = + fetchUsage(params, RequestOptions.none()) + + /** @see [fetchUsage] */ + @MustBeClosed + fun fetchUsage( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetchUsage(subscriptionId, SubscriptionFetchUsageParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /subscriptions/{subscription_id}/price_intervals`, * but is otherwise the same as [SubscriptionService.priceIntervals]. */ @MustBeClosed fun priceIntervals( - params: SubscriptionPriceIntervalsParams + subscriptionId: String ): HttpResponseFor = - priceIntervals(params, RequestOptions.none()) + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none()) + + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + priceIntervals( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + subscriptionId: String, + params: SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams.none(), + ): HttpResponseFor = + priceIntervals(subscriptionId, params, RequestOptions.none()) /** @see [priceIntervals] */ @MustBeClosed @@ -1165,12 +1675,47 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + params: SubscriptionPriceIntervalsParams + ): HttpResponseFor = + priceIntervals(params, RequestOptions.none()) + + /** @see [priceIntervals] */ + @MustBeClosed + fun priceIntervals( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + priceIntervals(subscriptionId, SubscriptionPriceIntervalsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/schedule_plan_change`, but is otherwise the same as * [SubscriptionService.schedulePlanChange]. */ @MustBeClosed + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + ): HttpResponseFor = + schedulePlanChange(subscriptionId, params, RequestOptions.none()) + + /** @see [schedulePlanChange] */ + @MustBeClosed + fun schedulePlanChange( + subscriptionId: String, + params: SubscriptionSchedulePlanChangeParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + schedulePlanChange( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [schedulePlanChange] */ + @MustBeClosed fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams ): HttpResponseFor = @@ -1189,9 +1734,26 @@ interface SubscriptionService { */ @MustBeClosed fun triggerPhase( - params: SubscriptionTriggerPhaseParams + subscriptionId: String ): HttpResponseFor = - triggerPhase(params, RequestOptions.none()) + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none()) + + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + triggerPhase(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + subscriptionId: String, + params: SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams.none(), + ): HttpResponseFor = + triggerPhase(subscriptionId, params, RequestOptions.none()) /** @see [triggerPhase] */ @MustBeClosed @@ -1200,6 +1762,21 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + params: SubscriptionTriggerPhaseParams + ): HttpResponseFor = + triggerPhase(params, RequestOptions.none()) + + /** @see [triggerPhase] */ + @MustBeClosed + fun triggerPhase( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + triggerPhase(subscriptionId, SubscriptionTriggerPhaseParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/unschedule_cancellation`, but is otherwise the same as @@ -1207,9 +1784,31 @@ interface SubscriptionService { */ @MustBeClosed fun unscheduleCancellation( - params: SubscriptionUnscheduleCancellationParams + subscriptionId: String ): HttpResponseFor = - unscheduleCancellation(params, RequestOptions.none()) + unscheduleCancellation(subscriptionId, SubscriptionUnscheduleCancellationParams.none()) + + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + unscheduleCancellation( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + subscriptionId: String, + params: SubscriptionUnscheduleCancellationParams = + SubscriptionUnscheduleCancellationParams.none(), + ): HttpResponseFor = + unscheduleCancellation(subscriptionId, params, RequestOptions.none()) /** @see [unscheduleCancellation] */ @MustBeClosed @@ -1218,12 +1817,51 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + params: SubscriptionUnscheduleCancellationParams + ): HttpResponseFor = + unscheduleCancellation(params, RequestOptions.none()) + + /** @see [unscheduleCancellation] */ + @MustBeClosed + fun unscheduleCancellation( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + unscheduleCancellation( + subscriptionId, + SubscriptionUnscheduleCancellationParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/unschedule_fixed_fee_quantity_updates`, but is otherwise * the same as [SubscriptionService.unscheduleFixedFeeQuantityUpdates]. */ @MustBeClosed + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + ): HttpResponseFor = + unscheduleFixedFeeQuantityUpdates(subscriptionId, params, RequestOptions.none()) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ + @MustBeClosed + fun unscheduleFixedFeeQuantityUpdates( + subscriptionId: String, + params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + unscheduleFixedFeeQuantityUpdates( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unscheduleFixedFeeQuantityUpdates] */ + @MustBeClosed fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams ): HttpResponseFor = @@ -1243,9 +1881,34 @@ interface SubscriptionService { */ @MustBeClosed fun unschedulePendingPlanChanges( - params: SubscriptionUnschedulePendingPlanChangesParams + subscriptionId: String ): HttpResponseFor = - unschedulePendingPlanChanges(params, RequestOptions.none()) + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + ) + + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + unschedulePendingPlanChanges( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + subscriptionId: String, + params: SubscriptionUnschedulePendingPlanChangesParams = + SubscriptionUnschedulePendingPlanChangesParams.none(), + ): HttpResponseFor = + unschedulePendingPlanChanges(subscriptionId, params, RequestOptions.none()) /** @see [unschedulePendingPlanChanges] */ @MustBeClosed @@ -1254,12 +1917,51 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + params: SubscriptionUnschedulePendingPlanChangesParams + ): HttpResponseFor = + unschedulePendingPlanChanges(params, RequestOptions.none()) + + /** @see [unschedulePendingPlanChanges] */ + @MustBeClosed + fun unschedulePendingPlanChanges( + subscriptionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + unschedulePendingPlanChanges( + subscriptionId, + SubscriptionUnschedulePendingPlanChangesParams.none(), + requestOptions, + ) + /** * Returns a raw HTTP response for `post * /subscriptions/{subscription_id}/update_fixed_fee_quantity`, but is otherwise the same as * [SubscriptionService.updateFixedFeeQuantity]. */ @MustBeClosed + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + ): HttpResponseFor = + updateFixedFeeQuantity(subscriptionId, params, RequestOptions.none()) + + /** @see [updateFixedFeeQuantity] */ + @MustBeClosed + fun updateFixedFeeQuantity( + subscriptionId: String, + params: SubscriptionUpdateFixedFeeQuantityParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + updateFixedFeeQuantity( + params.toBuilder().subscriptionId(subscriptionId).build(), + requestOptions, + ) + + /** @see [updateFixedFeeQuantity] */ + @MustBeClosed fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams ): HttpResponseFor = @@ -1277,6 +1979,23 @@ interface SubscriptionService { * is otherwise the same as [SubscriptionService.updateTrial]. */ @MustBeClosed + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + ): HttpResponseFor = + updateTrial(subscriptionId, params, RequestOptions.none()) + + /** @see [updateTrial] */ + @MustBeClosed + fun updateTrial( + subscriptionId: String, + params: SubscriptionUpdateTrialParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + updateTrial(params.toBuilder().subscriptionId(subscriptionId).build(), requestOptions) + + /** @see [updateTrial] */ + @MustBeClosed fun updateTrial( params: SubscriptionUpdateTrialParams ): HttpResponseFor = diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionServiceImpl.kt index f327e26bb..165037745 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -48,6 +49,7 @@ import com.withorb.api.models.SubscriptionUpdateTrialParams import com.withorb.api.models.SubscriptionUpdateTrialResponse import com.withorb.api.models.SubscriptionUsage import com.withorb.api.models.Subscriptions +import kotlin.jvm.optionals.getOrNull class SubscriptionServiceImpl internal constructor(private val clientOptions: ClientOptions) : SubscriptionService { @@ -210,6 +212,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -271,6 +276,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionCancelParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -298,6 +306,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -325,6 +336,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionFetchCostsParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -352,6 +366,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionFetchScheduleParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -385,6 +402,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionFetchUsageParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -412,6 +432,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionPriceIntervalsParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -440,6 +463,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionSchedulePlanChangeParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -468,6 +494,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionTriggerPhaseParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -497,6 +526,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionUnscheduleCancellationParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -532,6 +564,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -565,6 +600,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionUnschedulePendingPlanChangesParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -598,6 +636,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionUpdateFixedFeeQuantityParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -630,6 +671,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: SubscriptionUpdateTrialParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subscriptionId", params.subscriptionId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionService.kt index 60beb8ac2..a387d1816 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionService.kt @@ -21,8 +21,22 @@ interface SubscriptionService { * subscription. For a full discussion of the subscription resource, see * [Subscription](/core-concepts#subscription). */ - fun list(params: CouponSubscriptionListParams): CouponSubscriptionListPage = - list(params, RequestOptions.none()) + fun list(couponId: String): CouponSubscriptionListPage = + list(couponId, CouponSubscriptionListParams.none()) + + /** @see [list] */ + fun list( + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CouponSubscriptionListPage = + list(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [list] */ + fun list( + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + ): CouponSubscriptionListPage = list(couponId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -30,6 +44,14 @@ interface SubscriptionService { requestOptions: RequestOptions = RequestOptions.none(), ): CouponSubscriptionListPage + /** @see [list] */ + fun list(params: CouponSubscriptionListParams): CouponSubscriptionListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(couponId: String, requestOptions: RequestOptions): CouponSubscriptionListPage = + list(couponId, CouponSubscriptionListParams.none(), requestOptions) + /** * A view of [SubscriptionService] that provides access to raw HTTP responses for each method. */ @@ -40,9 +62,25 @@ interface SubscriptionService { * otherwise the same as [SubscriptionService.list]. */ @MustBeClosed + fun list(couponId: String): HttpResponseFor = + list(couponId, CouponSubscriptionListParams.none()) + + /** @see [list] */ + @MustBeClosed fun list( - params: CouponSubscriptionListParams - ): HttpResponseFor = list(params, RequestOptions.none()) + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().couponId(couponId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + couponId: String, + params: CouponSubscriptionListParams = CouponSubscriptionListParams.none(), + ): HttpResponseFor = + list(couponId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -50,5 +88,19 @@ interface SubscriptionService { params: CouponSubscriptionListParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [list] */ + @MustBeClosed + fun list( + params: CouponSubscriptionListParams + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + couponId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(couponId, CouponSubscriptionListParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceImpl.kt index d19b9301f..0dea7d0a1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.coupons import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -17,6 +18,7 @@ import com.withorb.api.core.prepare import com.withorb.api.models.CouponSubscriptionListPage import com.withorb.api.models.CouponSubscriptionListParams import com.withorb.api.models.Subscriptions +import kotlin.jvm.optionals.getOrNull class SubscriptionServiceImpl internal constructor(private val clientOptions: ClientOptions) : SubscriptionService { @@ -46,6 +48,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl params: CouponSubscriptionListParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("couponId", params.couponId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionService.kt index 58496cd0e..5faa1d9e7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionService.kt @@ -21,6 +21,20 @@ interface BalanceTransactionService { * Creates an immutable balance transaction that updates the customer's balance and returns back * the newly created transaction. */ + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + ): CustomerBalanceTransactionCreateResponse = create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerBalanceTransactionCreateResponse = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ fun create( params: CustomerBalanceTransactionCreateParams ): CustomerBalanceTransactionCreateResponse = create(params, RequestOptions.none()) @@ -58,8 +72,22 @@ interface BalanceTransactionService { * synced to a separate invoicing provider. If a payment gateway such as Stripe is used, the * balance will be applied to the invoice before forwarding payment to the gateway. */ - fun list(params: CustomerBalanceTransactionListParams): CustomerBalanceTransactionListPage = - list(params, RequestOptions.none()) + fun list(customerId: String): CustomerBalanceTransactionListPage = + list(customerId, CustomerBalanceTransactionListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerBalanceTransactionListParams = CustomerBalanceTransactionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerBalanceTransactionListPage = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerBalanceTransactionListParams = CustomerBalanceTransactionListParams.none(), + ): CustomerBalanceTransactionListPage = list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -67,6 +95,17 @@ interface BalanceTransactionService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerBalanceTransactionListPage + /** @see [list] */ + fun list(params: CustomerBalanceTransactionListParams): CustomerBalanceTransactionListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + customerId: String, + requestOptions: RequestOptions, + ): CustomerBalanceTransactionListPage = + list(customerId, CustomerBalanceTransactionListParams.none(), requestOptions) + /** * A view of [BalanceTransactionService] that provides access to raw HTTP responses for each * method. @@ -78,6 +117,23 @@ interface BalanceTransactionService { * is otherwise the same as [BalanceTransactionService.create]. */ @MustBeClosed + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + ): HttpResponseFor = + create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + customerId: String, + params: CustomerBalanceTransactionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ + @MustBeClosed fun create( params: CustomerBalanceTransactionCreateParams ): HttpResponseFor = @@ -95,9 +151,27 @@ interface BalanceTransactionService { * is otherwise the same as [BalanceTransactionService.list]. */ @MustBeClosed + fun list(customerId: String): HttpResponseFor = + list(customerId, CustomerBalanceTransactionListParams.none()) + + /** @see [list] */ + @MustBeClosed fun list( - params: CustomerBalanceTransactionListParams - ): HttpResponseFor = list(params, RequestOptions.none()) + customerId: String, + params: CustomerBalanceTransactionListParams = + CustomerBalanceTransactionListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerBalanceTransactionListParams = + CustomerBalanceTransactionListParams.none(), + ): HttpResponseFor = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -105,5 +179,19 @@ interface BalanceTransactionService { params: CustomerBalanceTransactionListParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerBalanceTransactionListParams + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(customerId, CustomerBalanceTransactionListParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceImpl.kt index f5b3f8885..ecca61662 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.customers import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -20,6 +21,7 @@ import com.withorb.api.models.CustomerBalanceTransactionCreateResponse import com.withorb.api.models.CustomerBalanceTransactionListPage import com.withorb.api.models.CustomerBalanceTransactionListPageResponse import com.withorb.api.models.CustomerBalanceTransactionListParams +import kotlin.jvm.optionals.getOrNull class BalanceTransactionServiceImpl internal constructor(private val clientOptions: ClientOptions) : BalanceTransactionService { @@ -57,6 +59,9 @@ class BalanceTransactionServiceImpl internal constructor(private val clientOptio params: CustomerBalanceTransactionCreateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -85,6 +90,9 @@ class BalanceTransactionServiceImpl internal constructor(private val clientOptio params: CustomerBalanceTransactionListParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt index 7a480744e..b620e805c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt @@ -127,8 +127,22 @@ interface CostService { * `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` and * `secondary_grouping_value` available. */ - fun list(params: CustomerCostListParams): CustomerCostListResponse = - list(params, RequestOptions.none()) + fun list(customerId: String): CustomerCostListResponse = + list(customerId, CustomerCostListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCostListResponse = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + ): CustomerCostListResponse = list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -136,6 +150,14 @@ interface CostService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCostListResponse + /** @see [list] */ + fun list(params: CustomerCostListParams): CustomerCostListResponse = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(customerId: String, requestOptions: RequestOptions): CustomerCostListResponse = + list(customerId, CustomerCostListParams.none(), requestOptions) + /** * This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated * by applying pricing information to the underlying usage (see the @@ -246,9 +268,26 @@ interface CostService { * `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` and * `secondary_grouping_value` available. */ + fun listByExternalId(externalCustomerId: String): CustomerCostListByExternalIdResponse = + listByExternalId(externalCustomerId, CustomerCostListByExternalIdParams.none()) + + /** @see [listByExternalId] */ fun listByExternalId( - params: CustomerCostListByExternalIdParams - ): CustomerCostListByExternalIdResponse = listByExternalId(params, RequestOptions.none()) + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCostListByExternalIdResponse = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + ): CustomerCostListByExternalIdResponse = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -256,6 +295,22 @@ interface CostService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCostListByExternalIdResponse + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCostListByExternalIdParams + ): CustomerCostListByExternalIdResponse = listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CustomerCostListByExternalIdResponse = + listByExternalId( + externalCustomerId, + CustomerCostListByExternalIdParams.none(), + requestOptions, + ) + /** A view of [CostService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -264,8 +319,25 @@ interface CostService { * the same as [CostService.list]. */ @MustBeClosed - fun list(params: CustomerCostListParams): HttpResponseFor = - list(params, RequestOptions.none()) + fun list(customerId: String): HttpResponseFor = + list(customerId, CustomerCostListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCostListParams = CustomerCostListParams.none(), + ): HttpResponseFor = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -274,6 +346,19 @@ interface CostService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [list] */ + @MustBeClosed + fun list(params: CustomerCostListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(customerId, CustomerCostListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get * /customers/external_customer_id/{external_customer_id}/costs`, but is otherwise the same @@ -281,9 +366,29 @@ interface CostService { */ @MustBeClosed fun listByExternalId( - params: CustomerCostListByExternalIdParams + externalCustomerId: String ): HttpResponseFor = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCostListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams.none(), + ): HttpResponseFor = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -291,5 +396,24 @@ interface CostService { params: CustomerCostListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCostListByExternalIdParams + ): HttpResponseFor = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listByExternalId( + externalCustomerId, + CustomerCostListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostServiceImpl.kt index cdee75f47..45fdbd67f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.customers import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -18,6 +19,7 @@ import com.withorb.api.models.CustomerCostListByExternalIdParams import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse +import kotlin.jvm.optionals.getOrNull class CostServiceImpl internal constructor(private val clientOptions: ClientOptions) : CostService { @@ -54,6 +56,9 @@ class CostServiceImpl internal constructor(private val clientOptions: ClientOpti params: CustomerCostListParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -81,6 +86,9 @@ class CostServiceImpl internal constructor(private val clientOptions: ClientOpti params: CustomerCostListByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditService.kt index 9d6638e1f..06e23be3e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditService.kt @@ -32,8 +32,22 @@ interface CreditService { * Note that `currency` defaults to credits if not specified. To use a real world currency, set * `currency` to an ISO 4217 string. */ - fun list(params: CustomerCreditListParams): CustomerCreditListPage = - list(params, RequestOptions.none()) + fun list(customerId: String): CustomerCreditListPage = + list(customerId, CustomerCreditListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditListPage = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + ): CustomerCreditListPage = list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -41,6 +55,14 @@ interface CreditService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditListPage + /** @see [list] */ + fun list(params: CustomerCreditListParams): CustomerCreditListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(customerId: String, requestOptions: RequestOptions): CustomerCreditListPage = + list(customerId, CustomerCreditListParams.none(), requestOptions) + /** * Returns a paginated list of unexpired, non-zero credit blocks for a customer. * @@ -50,9 +72,26 @@ interface CreditService { * Note that `currency` defaults to credits if not specified. To use a real world currency, set * `currency` to an ISO 4217 string. */ + fun listByExternalId(externalCustomerId: String): CustomerCreditListByExternalIdPage = + listByExternalId(externalCustomerId, CustomerCreditListByExternalIdParams.none()) + + /** @see [listByExternalId] */ fun listByExternalId( - params: CustomerCreditListByExternalIdParams - ): CustomerCreditListByExternalIdPage = listByExternalId(params, RequestOptions.none()) + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = CustomerCreditListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditListByExternalIdPage = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = CustomerCreditListByExternalIdParams.none(), + ): CustomerCreditListByExternalIdPage = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -60,6 +99,22 @@ interface CreditService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditListByExternalIdPage + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCreditListByExternalIdParams + ): CustomerCreditListByExternalIdPage = listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CustomerCreditListByExternalIdPage = + listByExternalId( + externalCustomerId, + CustomerCreditListByExternalIdParams.none(), + requestOptions, + ) + /** A view of [CreditService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -72,8 +127,24 @@ interface CreditService { * the same as [CreditService.list]. */ @MustBeClosed - fun list(params: CustomerCreditListParams): HttpResponseFor = - list(params, RequestOptions.none()) + fun list(customerId: String): HttpResponseFor = + list(customerId, CustomerCreditListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditListParams = CustomerCreditListParams.none(), + ): HttpResponseFor = list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -82,6 +153,19 @@ interface CreditService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [list] */ + @MustBeClosed + fun list(params: CustomerCreditListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(customerId, CustomerCreditListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get * /customers/external_customer_id/{external_customer_id}/credits`, but is otherwise the @@ -89,9 +173,31 @@ interface CreditService { */ @MustBeClosed fun listByExternalId( - params: CustomerCreditListByExternalIdParams + externalCustomerId: String ): HttpResponseFor = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = + CustomerCreditListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditListByExternalIdParams = + CustomerCreditListByExternalIdParams.none(), + ): HttpResponseFor = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -99,5 +205,24 @@ interface CreditService { params: CustomerCreditListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCreditListByExternalIdParams + ): HttpResponseFor = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listByExternalId( + externalCustomerId, + CustomerCreditListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditServiceImpl.kt index 421613a6f..30f623f91 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CreditServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.customers import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -24,6 +25,7 @@ import com.withorb.api.services.blocking.customers.credits.LedgerService import com.withorb.api.services.blocking.customers.credits.LedgerServiceImpl import com.withorb.api.services.blocking.customers.credits.TopUpService import com.withorb.api.services.blocking.customers.credits.TopUpServiceImpl +import kotlin.jvm.optionals.getOrNull class CreditServiceImpl internal constructor(private val clientOptions: ClientOptions) : CreditService { @@ -81,6 +83,9 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp params: CustomerCreditListParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -115,6 +120,9 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp params: CustomerCreditListByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt index 27473ba1c..d23b56a7a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt @@ -100,8 +100,22 @@ interface LedgerService { * When credits are added to a customer's balance as a result of a correction, this entry will * be added to the ledger to indicate the adjustment of credits. */ - fun list(params: CustomerCreditLedgerListParams): CustomerCreditLedgerListPage = - list(params, RequestOptions.none()) + fun list(customerId: String): CustomerCreditLedgerListPage = + list(customerId, CustomerCreditLedgerListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditLedgerListPage = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + ): CustomerCreditLedgerListPage = list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -109,6 +123,14 @@ interface LedgerService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditLedgerListPage + /** @see [list] */ + fun list(params: CustomerCreditLedgerListParams): CustomerCreditLedgerListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(customerId: String, requestOptions: RequestOptions): CustomerCreditLedgerListPage = + list(customerId, CustomerCreditLedgerListParams.none(), requestOptions) + /** * This endpoint allows you to create a new ledger entry for a specified customer's balance. * This can be used to increment balance, deduct credits, and change the expiry date of existing @@ -212,6 +234,21 @@ interface LedgerService { * decremented from, and `amount` indicates how many credits to return to the customer, up to * the block's initial balance. */ + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + ): CustomerCreditLedgerCreateEntryResponse = + createEntry(customerId, params, RequestOptions.none()) + + /** @see [createEntry] */ + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditLedgerCreateEntryResponse = + createEntry(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createEntry] */ fun createEntry( params: CustomerCreditLedgerCreateEntryParams ): CustomerCreditLedgerCreateEntryResponse = createEntry(params, RequestOptions.none()) @@ -325,6 +362,24 @@ interface LedgerService { * decremented from, and `amount` indicates how many credits to return to the customer, up to * the block's initial balance. */ + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + ): CustomerCreditLedgerCreateEntryByExternalIdResponse = + createEntryByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createEntryByExternalId] */ + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditLedgerCreateEntryByExternalIdResponse = + createEntryByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createEntryByExternalId] */ fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams ): CustomerCreditLedgerCreateEntryByExternalIdResponse = @@ -415,9 +470,28 @@ interface LedgerService { * When credits are added to a customer's balance as a result of a correction, this entry will * be added to the ledger to indicate the adjustment of credits. */ + fun listByExternalId(externalCustomerId: String): CustomerCreditLedgerListByExternalIdPage = + listByExternalId(externalCustomerId, CustomerCreditLedgerListByExternalIdParams.none()) + + /** @see [listByExternalId] */ fun listByExternalId( - params: CustomerCreditLedgerListByExternalIdParams - ): CustomerCreditLedgerListByExternalIdPage = listByExternalId(params, RequestOptions.none()) + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditLedgerListByExternalIdPage = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + ): CustomerCreditLedgerListByExternalIdPage = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -425,6 +499,22 @@ interface LedgerService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditLedgerListByExternalIdPage + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCreditLedgerListByExternalIdParams + ): CustomerCreditLedgerListByExternalIdPage = listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CustomerCreditLedgerListByExternalIdPage = + listByExternalId( + externalCustomerId, + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions, + ) + /** A view of [LedgerService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -433,9 +523,25 @@ interface LedgerService { * otherwise the same as [LedgerService.list]. */ @MustBeClosed + fun list(customerId: String): HttpResponseFor = + list(customerId, CustomerCreditLedgerListParams.none()) + + /** @see [list] */ + @MustBeClosed fun list( - params: CustomerCreditLedgerListParams - ): HttpResponseFor = list(params, RequestOptions.none()) + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditLedgerListParams = CustomerCreditLedgerListParams.none(), + ): HttpResponseFor = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -444,11 +550,42 @@ interface LedgerService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerCreditLedgerListParams + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(customerId, CustomerCreditLedgerListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /customers/{customer_id}/credits/ledger_entry`, but * is otherwise the same as [LedgerService.createEntry]. */ @MustBeClosed + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + ): HttpResponseFor = + createEntry(customerId, params, RequestOptions.none()) + + /** @see [createEntry] */ + @MustBeClosed + fun createEntry( + customerId: String, + params: CustomerCreditLedgerCreateEntryParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createEntry(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [createEntry] */ + @MustBeClosed fun createEntry( params: CustomerCreditLedgerCreateEntryParams ): HttpResponseFor = @@ -467,6 +604,26 @@ interface LedgerService { * otherwise the same as [LedgerService.createEntryByExternalId]. */ @MustBeClosed + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + ): HttpResponseFor = + createEntryByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createEntryByExternalId] */ + @MustBeClosed + fun createEntryByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerCreateEntryByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createEntryByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createEntryByExternalId] */ + @MustBeClosed fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams ): HttpResponseFor = @@ -486,9 +643,31 @@ interface LedgerService { */ @MustBeClosed fun listByExternalId( - params: CustomerCreditLedgerListByExternalIdParams + externalCustomerId: String ): HttpResponseFor = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditLedgerListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditLedgerListByExternalIdParams = + CustomerCreditLedgerListByExternalIdParams.none(), + ): HttpResponseFor = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -496,5 +675,24 @@ interface LedgerService { params: CustomerCreditLedgerListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCreditLedgerListByExternalIdParams + ): HttpResponseFor = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listByExternalId( + externalCustomerId, + CustomerCreditLedgerListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceImpl.kt index 25a4c60b8..23ffb601f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.customers.credits import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -25,6 +26,7 @@ import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerListPage import com.withorb.api.models.CustomerCreditLedgerListPageResponse import com.withorb.api.models.CustomerCreditLedgerListParams +import kotlin.jvm.optionals.getOrNull class LedgerServiceImpl internal constructor(private val clientOptions: ClientOptions) : LedgerService { @@ -76,6 +78,9 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp params: CustomerCreditLedgerListParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -110,6 +115,9 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp params: CustomerCreditLedgerCreateEntryParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -141,6 +149,9 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp params: CustomerCreditLedgerCreateEntryByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -176,6 +187,9 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp params: CustomerCreditLedgerListByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt index 6714d22a8..27bee5fa8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt @@ -32,6 +32,20 @@ interface TopUpService { * If a top-up already exists for this customer in the same currency, the existing top-up will * be replaced. */ + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + ): CustomerCreditTopUpCreateResponse = create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditTopUpCreateResponse = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ fun create(params: CustomerCreditTopUpCreateParams): CustomerCreditTopUpCreateResponse = create(params, RequestOptions.none()) @@ -42,8 +56,22 @@ interface TopUpService { ): CustomerCreditTopUpCreateResponse /** List top-ups */ - fun list(params: CustomerCreditTopUpListParams): CustomerCreditTopUpListPage = - list(params, RequestOptions.none()) + fun list(customerId: String): CustomerCreditTopUpListPage = + list(customerId, CustomerCreditTopUpListParams.none()) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditTopUpListPage = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + fun list( + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + ): CustomerCreditTopUpListPage = list(customerId, params, RequestOptions.none()) /** @see [list] */ fun list( @@ -51,10 +79,29 @@ interface TopUpService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpListPage + /** @see [list] */ + fun list(params: CustomerCreditTopUpListParams): CustomerCreditTopUpListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(customerId: String, requestOptions: RequestOptions): CustomerCreditTopUpListPage = + list(customerId, CustomerCreditTopUpListParams.none(), requestOptions) + /** * This deactivates the top-up and voids any invoices associated with pending credit blocks * purchased through the top-up. */ + fun delete(topUpId: String, params: CustomerCreditTopUpDeleteParams) = + delete(topUpId, params, RequestOptions.none()) + + /** @see [delete] */ + fun delete( + topUpId: String, + params: CustomerCreditTopUpDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ) = delete(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [delete] */ fun delete(params: CustomerCreditTopUpDeleteParams) = delete(params, RequestOptions.none()) /** @see [delete] */ @@ -71,6 +118,24 @@ interface TopUpService { * If a top-up already exists for this customer in the same currency, the existing top-up will * be replaced. */ + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + ): CustomerCreditTopUpCreateByExternalIdResponse = + createByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createByExternalId] */ + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditTopUpCreateByExternalIdResponse = + createByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createByExternalId] */ fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams ): CustomerCreditTopUpCreateByExternalIdResponse = @@ -86,6 +151,17 @@ interface TopUpService { * This deactivates the top-up and voids any invoices associated with pending credit blocks * purchased through the top-up. */ + fun deleteByExternalId(topUpId: String, params: CustomerCreditTopUpDeleteByExternalIdParams) = + deleteByExternalId(topUpId, params, RequestOptions.none()) + + /** @see [deleteByExternalId] */ + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ) = deleteByExternalId(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [deleteByExternalId] */ fun deleteByExternalId(params: CustomerCreditTopUpDeleteByExternalIdParams) = deleteByExternalId(params, RequestOptions.none()) @@ -96,9 +172,28 @@ interface TopUpService { ) /** List top-ups by external ID */ + fun listByExternalId(externalCustomerId: String): CustomerCreditTopUpListByExternalIdPage = + listByExternalId(externalCustomerId, CustomerCreditTopUpListByExternalIdParams.none()) + + /** @see [listByExternalId] */ fun listByExternalId( - params: CustomerCreditTopUpListByExternalIdParams - ): CustomerCreditTopUpListByExternalIdPage = listByExternalId(params, RequestOptions.none()) + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CustomerCreditTopUpListByExternalIdPage = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + ): CustomerCreditTopUpListByExternalIdPage = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ fun listByExternalId( @@ -106,6 +201,22 @@ interface TopUpService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpListByExternalIdPage + /** @see [listByExternalId] */ + fun listByExternalId( + params: CustomerCreditTopUpListByExternalIdParams + ): CustomerCreditTopUpListByExternalIdPage = listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): CustomerCreditTopUpListByExternalIdPage = + listByExternalId( + externalCustomerId, + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions, + ) + /** A view of [TopUpService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -114,6 +225,23 @@ interface TopUpService { * otherwise the same as [TopUpService.create]. */ @MustBeClosed + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + ): HttpResponseFor = + create(customerId, params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + customerId: String, + params: CustomerCreditTopUpCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [create] */ + @MustBeClosed fun create( params: CustomerCreditTopUpCreateParams ): HttpResponseFor = @@ -131,9 +259,25 @@ interface TopUpService { * otherwise the same as [TopUpService.list]. */ @MustBeClosed + fun list(customerId: String): HttpResponseFor = + list(customerId, CustomerCreditTopUpListParams.none()) + + /** @see [list] */ + @MustBeClosed fun list( - params: CustomerCreditTopUpListParams - ): HttpResponseFor = list(params, RequestOptions.none()) + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().customerId(customerId).build(), requestOptions) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + params: CustomerCreditTopUpListParams = CustomerCreditTopUpListParams.none(), + ): HttpResponseFor = + list(customerId, params, RequestOptions.none()) /** @see [list] */ @MustBeClosed @@ -142,12 +286,39 @@ interface TopUpService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [list] */ + @MustBeClosed + fun list( + params: CustomerCreditTopUpListParams + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + customerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(customerId, CustomerCreditTopUpListParams.none(), requestOptions) + /** * Returns a raw HTTP response for `delete * /customers/{customer_id}/credits/top_ups/{top_up_id}`, but is otherwise the same as * [TopUpService.delete]. */ @MustBeClosed + fun delete(topUpId: String, params: CustomerCreditTopUpDeleteParams): HttpResponse = + delete(topUpId, params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + topUpId: String, + params: CustomerCreditTopUpDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = delete(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [delete] */ + @MustBeClosed fun delete(params: CustomerCreditTopUpDeleteParams): HttpResponse = delete(params, RequestOptions.none()) @@ -164,6 +335,26 @@ interface TopUpService { * the same as [TopUpService.createByExternalId]. */ @MustBeClosed + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + ): HttpResponseFor = + createByExternalId(externalCustomerId, params, RequestOptions.none()) + + /** @see [createByExternalId] */ + @MustBeClosed + fun createByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpCreateByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [createByExternalId] */ + @MustBeClosed fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams ): HttpResponseFor = @@ -182,6 +373,22 @@ interface TopUpService { * is otherwise the same as [TopUpService.deleteByExternalId]. */ @MustBeClosed + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + ): HttpResponse = deleteByExternalId(topUpId, params, RequestOptions.none()) + + /** @see [deleteByExternalId] */ + @MustBeClosed + fun deleteByExternalId( + topUpId: String, + params: CustomerCreditTopUpDeleteByExternalIdParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = + deleteByExternalId(params.toBuilder().topUpId(topUpId).build(), requestOptions) + + /** @see [deleteByExternalId] */ + @MustBeClosed fun deleteByExternalId(params: CustomerCreditTopUpDeleteByExternalIdParams): HttpResponse = deleteByExternalId(params, RequestOptions.none()) @@ -199,9 +406,31 @@ interface TopUpService { */ @MustBeClosed fun listByExternalId( - params: CustomerCreditTopUpListByExternalIdParams + externalCustomerId: String ): HttpResponseFor = - listByExternalId(params, RequestOptions.none()) + listByExternalId(externalCustomerId, CustomerCreditTopUpListByExternalIdParams.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listByExternalId( + params.toBuilder().externalCustomerId(externalCustomerId).build(), + requestOptions, + ) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + params: CustomerCreditTopUpListByExternalIdParams = + CustomerCreditTopUpListByExternalIdParams.none(), + ): HttpResponseFor = + listByExternalId(externalCustomerId, params, RequestOptions.none()) /** @see [listByExternalId] */ @MustBeClosed @@ -209,5 +438,24 @@ interface TopUpService { params: CustomerCreditTopUpListByExternalIdParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + params: CustomerCreditTopUpListByExternalIdParams + ): HttpResponseFor = + listByExternalId(params, RequestOptions.none()) + + /** @see [listByExternalId] */ + @MustBeClosed + fun listByExternalId( + externalCustomerId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listByExternalId( + externalCustomerId, + CustomerCreditTopUpListByExternalIdParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt index 626104a6e..395681330 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.customers.credits import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.emptyHandler import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler @@ -29,6 +30,7 @@ import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpListPage import com.withorb.api.models.CustomerCreditTopUpListPageResponse import com.withorb.api.models.CustomerCreditTopUpListParams +import kotlin.jvm.optionals.getOrNull class TopUpServiceImpl internal constructor(private val clientOptions: ClientOptions) : TopUpService { @@ -93,6 +95,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt params: CustomerCreditTopUpCreateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -121,6 +126,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt params: CustomerCreditTopUpListParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("customerId", params.customerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -153,6 +161,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt params: CustomerCreditTopUpDeleteParams, requestOptions: RequestOptions, ): HttpResponse { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("topUpId", params.topUpId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.DELETE) @@ -180,6 +191,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt params: CustomerCreditTopUpCreateByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -213,6 +227,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt params: CustomerCreditTopUpDeleteByExternalIdParams, requestOptions: RequestOptions, ): HttpResponse { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("topUpId", params.topUpId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.DELETE) @@ -241,6 +258,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt params: CustomerCreditTopUpListByExternalIdParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalCustomerId", params.externalCustomerId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdService.kt index d1ac55cdf..ccc38f0ff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdService.kt @@ -16,9 +16,34 @@ interface ExternalDimensionalPriceGroupIdService { fun withRawResponse(): WithRawResponse /** Fetch dimensional price group by external ID */ + fun retrieve(externalDimensionalPriceGroupId: String): DimensionalPriceGroup = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ) + + /** @see [retrieve] */ fun retrieve( - params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams - ): DimensionalPriceGroup = retrieve(params, RequestOptions.none()) + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): DimensionalPriceGroup = + retrieve( + params + .toBuilder() + .externalDimensionalPriceGroupId(externalDimensionalPriceGroupId) + .build(), + requestOptions, + ) + + /** @see [retrieve] */ + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ): DimensionalPriceGroup = + retrieve(externalDimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ fun retrieve( @@ -26,6 +51,22 @@ interface ExternalDimensionalPriceGroupIdService { requestOptions: RequestOptions = RequestOptions.none(), ): DimensionalPriceGroup + /** @see [retrieve] */ + fun retrieve( + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams + ): DimensionalPriceGroup = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + externalDimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): DimensionalPriceGroup = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions, + ) + /** * A view of [ExternalDimensionalPriceGroupIdService] that provides access to raw HTTP responses * for each method. @@ -39,8 +80,37 @@ interface ExternalDimensionalPriceGroupIdService { */ @MustBeClosed fun retrieve( - params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams - ): HttpResponseFor = retrieve(params, RequestOptions.none()) + externalDimensionalPriceGroupId: String + ): HttpResponseFor = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve( + params + .toBuilder() + .externalDimensionalPriceGroupId(externalDimensionalPriceGroupId) + .build(), + requestOptions, + ) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + externalDimensionalPriceGroupId: String, + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams = + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + ): HttpResponseFor = + retrieve(externalDimensionalPriceGroupId, params, RequestOptions.none()) /** @see [retrieve] */ @MustBeClosed @@ -48,5 +118,23 @@ interface ExternalDimensionalPriceGroupIdService { params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + externalDimensionalPriceGroupId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve( + externalDimensionalPriceGroupId, + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.none(), + requestOptions, + ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceImpl.kt index b22f2e415..ce3cd2e75 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.dimensionalPriceGroups import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -16,6 +17,7 @@ import com.withorb.api.core.http.parseable import com.withorb.api.core.prepare import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams +import kotlin.jvm.optionals.getOrNull class ExternalDimensionalPriceGroupIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -49,6 +51,12 @@ internal constructor(private val clientOptions: ClientOptions) : params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired( + "externalDimensionalPriceGroupId", + params.externalDimensionalPriceGroupId().getOrNull(), + ) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillService.kt index 37532f160..d58359491 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillService.kt @@ -92,8 +92,22 @@ interface BackfillService { * asynchronously reflect the updated usage in invoice amounts and usage graphs. Once all of the * updates are complete, the backfill's status will transition to `reflected`. */ - fun close(params: EventBackfillCloseParams): EventBackfillCloseResponse = - close(params, RequestOptions.none()) + fun close(backfillId: String): EventBackfillCloseResponse = + close(backfillId, EventBackfillCloseParams.none()) + + /** @see [close] */ + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): EventBackfillCloseResponse = + close(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [close] */ + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + ): EventBackfillCloseResponse = close(backfillId, params, RequestOptions.none()) /** @see [close] */ fun close( @@ -101,9 +115,31 @@ interface BackfillService { requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillCloseResponse + /** @see [close] */ + fun close(params: EventBackfillCloseParams): EventBackfillCloseResponse = + close(params, RequestOptions.none()) + + /** @see [close] */ + fun close(backfillId: String, requestOptions: RequestOptions): EventBackfillCloseResponse = + close(backfillId, EventBackfillCloseParams.none(), requestOptions) + /** This endpoint is used to fetch a backfill given an identifier. */ - fun fetch(params: EventBackfillFetchParams): EventBackfillFetchResponse = - fetch(params, RequestOptions.none()) + fun fetch(backfillId: String): EventBackfillFetchResponse = + fetch(backfillId, EventBackfillFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): EventBackfillFetchResponse = + fetch(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + ): EventBackfillFetchResponse = fetch(backfillId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -111,6 +147,14 @@ interface BackfillService { requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillFetchResponse + /** @see [fetch] */ + fun fetch(params: EventBackfillFetchParams): EventBackfillFetchResponse = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(backfillId: String, requestOptions: RequestOptions): EventBackfillFetchResponse = + fetch(backfillId, EventBackfillFetchParams.none(), requestOptions) + /** * Reverting a backfill undoes all the effects of closing the backfill. If the backfill is * reflected, the status will transition to `pending_revert` while the effects of the backfill @@ -119,8 +163,22 @@ interface BackfillService { * If a backfill is reverted before its closed, no usage will be updated as a result of the * backfill and it will immediately transition to `reverted`. */ - fun revert(params: EventBackfillRevertParams): EventBackfillRevertResponse = - revert(params, RequestOptions.none()) + fun revert(backfillId: String): EventBackfillRevertResponse = + revert(backfillId, EventBackfillRevertParams.none()) + + /** @see [revert] */ + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): EventBackfillRevertResponse = + revert(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [revert] */ + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + ): EventBackfillRevertResponse = revert(backfillId, params, RequestOptions.none()) /** @see [revert] */ fun revert( @@ -128,6 +186,14 @@ interface BackfillService { requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillRevertResponse + /** @see [revert] */ + fun revert(params: EventBackfillRevertParams): EventBackfillRevertResponse = + revert(params, RequestOptions.none()) + + /** @see [revert] */ + fun revert(backfillId: String, requestOptions: RequestOptions): EventBackfillRevertResponse = + revert(backfillId, EventBackfillRevertParams.none(), requestOptions) + /** A view of [BackfillService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -177,8 +243,25 @@ interface BackfillService { * otherwise the same as [BackfillService.close]. */ @MustBeClosed - fun close(params: EventBackfillCloseParams): HttpResponseFor = - close(params, RequestOptions.none()) + fun close(backfillId: String): HttpResponseFor = + close(backfillId, EventBackfillCloseParams.none()) + + /** @see [close] */ + @MustBeClosed + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + close(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [close] */ + @MustBeClosed + fun close( + backfillId: String, + params: EventBackfillCloseParams = EventBackfillCloseParams.none(), + ): HttpResponseFor = + close(backfillId, params, RequestOptions.none()) /** @see [close] */ @MustBeClosed @@ -187,13 +270,43 @@ interface BackfillService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [close] */ + @MustBeClosed + fun close(params: EventBackfillCloseParams): HttpResponseFor = + close(params, RequestOptions.none()) + + /** @see [close] */ + @MustBeClosed + fun close( + backfillId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + close(backfillId, EventBackfillCloseParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /events/backfills/{backfill_id}`, but is otherwise * the same as [BackfillService.fetch]. */ @MustBeClosed - fun fetch(params: EventBackfillFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(backfillId: String): HttpResponseFor = + fetch(backfillId, EventBackfillFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + backfillId: String, + params: EventBackfillFetchParams = EventBackfillFetchParams.none(), + ): HttpResponseFor = + fetch(backfillId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -202,14 +315,43 @@ interface BackfillService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: EventBackfillFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + backfillId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + fetch(backfillId, EventBackfillFetchParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /events/backfills/{backfill_id}/revert`, but is * otherwise the same as [BackfillService.revert]. */ @MustBeClosed + fun revert(backfillId: String): HttpResponseFor = + revert(backfillId, EventBackfillRevertParams.none()) + + /** @see [revert] */ + @MustBeClosed fun revert( - params: EventBackfillRevertParams - ): HttpResponseFor = revert(params, RequestOptions.none()) + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + revert(params.toBuilder().backfillId(backfillId).build(), requestOptions) + + /** @see [revert] */ + @MustBeClosed + fun revert( + backfillId: String, + params: EventBackfillRevertParams = EventBackfillRevertParams.none(), + ): HttpResponseFor = + revert(backfillId, params, RequestOptions.none()) /** @see [revert] */ @MustBeClosed @@ -217,5 +359,19 @@ interface BackfillService { params: EventBackfillRevertParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [revert] */ + @MustBeClosed + fun revert( + params: EventBackfillRevertParams + ): HttpResponseFor = revert(params, RequestOptions.none()) + + /** @see [revert] */ + @MustBeClosed + fun revert( + backfillId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + revert(backfillId, EventBackfillRevertParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillServiceImpl.kt index 5f2af3181..6fbf3336a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/BackfillServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.events import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -26,6 +27,7 @@ import com.withorb.api.models.EventBackfillListPageResponse import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse +import kotlin.jvm.optionals.getOrNull class BackfillServiceImpl internal constructor(private val clientOptions: ClientOptions) : BackfillService { @@ -146,6 +148,9 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client params: EventBackfillCloseParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("backfillId", params.backfillId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -174,6 +179,9 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client params: EventBackfillFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("backfillId", params.backfillId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -201,6 +209,9 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client params: EventBackfillRevertParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("backfillId", params.backfillId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdService.kt index 0a64853c9..39431961f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdService.kt @@ -22,7 +22,22 @@ interface ExternalPlanIdService { * * Other fields on a customer are currently immutable. */ - fun update(params: PlanExternalPlanIdUpdateParams): Plan = update(params, RequestOptions.none()) + fun update(otherExternalPlanId: String): Plan = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none()) + + /** @see [update] */ + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Plan = + update(params.toBuilder().otherExternalPlanId(otherExternalPlanId).build(), requestOptions) + + /** @see [update] */ + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + ): Plan = update(otherExternalPlanId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -30,6 +45,13 @@ interface ExternalPlanIdService { requestOptions: RequestOptions = RequestOptions.none(), ): Plan + /** @see [update] */ + fun update(params: PlanExternalPlanIdUpdateParams): Plan = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(otherExternalPlanId: String, requestOptions: RequestOptions): Plan = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none(), requestOptions) + /** * This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details given an * external_plan_id identifier. It returns information about the prices included in the plan and @@ -47,7 +69,21 @@ interface ExternalPlanIdService { * detailed explanation of price types can be found in the * [Price schema](/core-concepts#plan-and-price). " */ - fun fetch(params: PlanExternalPlanIdFetchParams): Plan = fetch(params, RequestOptions.none()) + fun fetch(externalPlanId: String): Plan = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Plan = fetch(params.toBuilder().externalPlanId(externalPlanId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + ): Plan = fetch(externalPlanId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -55,6 +91,13 @@ interface ExternalPlanIdService { requestOptions: RequestOptions = RequestOptions.none(), ): Plan + /** @see [fetch] */ + fun fetch(params: PlanExternalPlanIdFetchParams): Plan = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(externalPlanId: String, requestOptions: RequestOptions): Plan = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none(), requestOptions) + /** * A view of [ExternalPlanIdService] that provides access to raw HTTP responses for each method. */ @@ -65,8 +108,27 @@ interface ExternalPlanIdService { * otherwise the same as [ExternalPlanIdService.update]. */ @MustBeClosed - fun update(params: PlanExternalPlanIdUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(otherExternalPlanId: String): HttpResponseFor = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update( + params.toBuilder().otherExternalPlanId(otherExternalPlanId).build(), + requestOptions, + ) + + /** @see [update] */ + @MustBeClosed + fun update( + otherExternalPlanId: String, + params: PlanExternalPlanIdUpdateParams = PlanExternalPlanIdUpdateParams.none(), + ): HttpResponseFor = update(otherExternalPlanId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -75,13 +137,42 @@ interface ExternalPlanIdService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: PlanExternalPlanIdUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + otherExternalPlanId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(otherExternalPlanId, PlanExternalPlanIdUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /plans/external_plan_id/{external_plan_id}`, but is * otherwise the same as [ExternalPlanIdService.fetch]. */ @MustBeClosed - fun fetch(params: PlanExternalPlanIdFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(externalPlanId: String): HttpResponseFor = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().externalPlanId(externalPlanId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPlanId: String, + params: PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams.none(), + ): HttpResponseFor = fetch(externalPlanId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -89,5 +180,15 @@ interface ExternalPlanIdService { params: PlanExternalPlanIdFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PlanExternalPlanIdFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(externalPlanId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(externalPlanId, PlanExternalPlanIdFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceImpl.kt index 464cadc3a..6fccf86e4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.plans import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -18,6 +19,7 @@ import com.withorb.api.core.prepare import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams +import kotlin.jvm.optionals.getOrNull class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdService { @@ -54,6 +56,9 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: params: PlanExternalPlanIdUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("otherExternalPlanId", params.otherExternalPlanId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -81,6 +86,9 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: params: PlanExternalPlanIdFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalPlanId", params.externalPlanId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdService.kt index 24353ff8a..4ea638ffc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdService.kt @@ -20,8 +20,21 @@ interface ExternalPriceIdService { * This endpoint allows you to update the `metadata` property on a price. If you pass null for * the metadata value, it will clear any existing metadata for that price. */ - fun update(params: PriceExternalPriceIdUpdateParams): Price = - update(params, RequestOptions.none()) + fun update(externalPriceId: String): Price = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none()) + + /** @see [update] */ + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Price = update(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [update] */ + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + ): Price = update(externalPriceId, params, RequestOptions.none()) /** @see [update] */ fun update( @@ -29,12 +42,34 @@ interface ExternalPriceIdService { requestOptions: RequestOptions = RequestOptions.none(), ): Price + /** @see [update] */ + fun update(params: PriceExternalPriceIdUpdateParams): Price = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update(externalPriceId: String, requestOptions: RequestOptions): Price = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none(), requestOptions) + /** * This endpoint returns a price given an external price id. See the * [price creation API](/api-reference/price/create-price) for more information about external * price aliases. */ - fun fetch(params: PriceExternalPriceIdFetchParams): Price = fetch(params, RequestOptions.none()) + fun fetch(externalPriceId: String): Price = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none()) + + /** @see [fetch] */ + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Price = fetch(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [fetch] */ + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + ): Price = fetch(externalPriceId, params, RequestOptions.none()) /** @see [fetch] */ fun fetch( @@ -42,6 +77,13 @@ interface ExternalPriceIdService { requestOptions: RequestOptions = RequestOptions.none(), ): Price + /** @see [fetch] */ + fun fetch(params: PriceExternalPriceIdFetchParams): Price = fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + fun fetch(externalPriceId: String, requestOptions: RequestOptions): Price = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none(), requestOptions) + /** * A view of [ExternalPriceIdService] that provides access to raw HTTP responses for each * method. @@ -53,8 +95,24 @@ interface ExternalPriceIdService { * is otherwise the same as [ExternalPriceIdService.update]. */ @MustBeClosed - fun update(params: PriceExternalPriceIdUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) + fun update(externalPriceId: String): HttpResponseFor = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [update] */ + @MustBeClosed + fun update( + externalPriceId: String, + params: PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams.none(), + ): HttpResponseFor = update(externalPriceId, params, RequestOptions.none()) /** @see [update] */ @MustBeClosed @@ -63,13 +121,42 @@ interface ExternalPriceIdService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see [update] */ + @MustBeClosed + fun update(params: PriceExternalPriceIdUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + externalPriceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(externalPriceId, PriceExternalPriceIdUpdateParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /prices/external_price_id/{external_price_id}`, but * is otherwise the same as [ExternalPriceIdService.fetch]. */ @MustBeClosed - fun fetch(params: PriceExternalPriceIdFetchParams): HttpResponseFor = - fetch(params, RequestOptions.none()) + fun fetch(externalPriceId: String): HttpResponseFor = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + fetch(params.toBuilder().externalPriceId(externalPriceId).build(), requestOptions) + + /** @see [fetch] */ + @MustBeClosed + fun fetch( + externalPriceId: String, + params: PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams.none(), + ): HttpResponseFor = fetch(externalPriceId, params, RequestOptions.none()) /** @see [fetch] */ @MustBeClosed @@ -77,5 +164,15 @@ interface ExternalPriceIdService { params: PriceExternalPriceIdFetchParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see [fetch] */ + @MustBeClosed + fun fetch(params: PriceExternalPriceIdFetchParams): HttpResponseFor = + fetch(params, RequestOptions.none()) + + /** @see [fetch] */ + @MustBeClosed + fun fetch(externalPriceId: String, requestOptions: RequestOptions): HttpResponseFor = + fetch(externalPriceId, PriceExternalPriceIdFetchParams.none(), requestOptions) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceImpl.kt index 8b7730193..b0c9db983 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceImpl.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking.prices import com.withorb.api.core.ClientOptions import com.withorb.api.core.JsonValue import com.withorb.api.core.RequestOptions +import com.withorb.api.core.checkRequired import com.withorb.api.core.handlers.errorHandler import com.withorb.api.core.handlers.jsonHandler import com.withorb.api.core.handlers.withErrorHandler @@ -18,6 +19,7 @@ import com.withorb.api.core.prepare import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams +import kotlin.jvm.optionals.getOrNull class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : ExternalPriceIdService { @@ -54,6 +56,9 @@ class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: params: PriceExternalPriceIdUpdateParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalPriceId", params.externalPriceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -81,6 +86,9 @@ class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: params: PriceExternalPriceIdFetchParams, requestOptions: RequestOptions, ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalPriceId", params.externalPriceId().getOrNull()) val request = HttpRequest.builder() .method(HttpMethod.GET) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt index cd147e8a5..85fd43314 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt @@ -9,7 +9,6 @@ import com.withorb.api.models.AlertCreateForExternalCustomerParams import com.withorb.api.models.AlertCreateForSubscriptionParams import com.withorb.api.models.AlertDisableParams import com.withorb.api.models.AlertEnableParams -import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -27,8 +26,7 @@ internal class AlertServiceAsyncTest { .build() val alertServiceAsync = client.alerts() - val alertFuture = - alertServiceAsync.retrieve(AlertRetrieveParams.builder().alertId("alert_id").build()) + val alertFuture = alertServiceAsync.retrieve("alert_id") val alert = alertFuture.get() alert.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt index 28c7dbf46..eec0b310e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt @@ -4,9 +4,7 @@ package com.withorb.api.services.async import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync -import com.withorb.api.models.CouponArchiveParams import com.withorb.api.models.CouponCreateParams -import com.withorb.api.models.CouponFetchParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -60,8 +58,7 @@ internal class CouponServiceAsyncTest { .build() val couponServiceAsync = client.coupons() - val couponFuture = - couponServiceAsync.archive(CouponArchiveParams.builder().couponId("coupon_id").build()) + val couponFuture = couponServiceAsync.archive("coupon_id") val coupon = couponFuture.get() coupon.validate() @@ -76,8 +73,7 @@ internal class CouponServiceAsyncTest { .build() val couponServiceAsync = client.coupons() - val couponFuture = - couponServiceAsync.fetch(CouponFetchParams.builder().couponId("coupon_id").build()) + val couponFuture = couponServiceAsync.fetch("coupon_id") val coupon = couponFuture.get() coupon.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt index 8b097942b..01119641e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.async import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.models.CreditNoteCreateParams -import com.withorb.api.models.CreditNoteFetchParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -63,10 +62,7 @@ internal class CreditNoteServiceAsyncTest { .build() val creditNoteServiceAsync = client.creditNotes() - val creditNoteFuture = - creditNoteServiceAsync.fetch( - CreditNoteFetchParams.builder().creditNoteId("credit_note_id").build() - ) + val creditNoteFuture = creditNoteServiceAsync.fetch("credit_note_id") val creditNote = creditNoteFuture.get() creditNote.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt index 4581627d2..3ad5c7d29 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt @@ -6,11 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.CustomerCreateParams -import com.withorb.api.models.CustomerDeleteParams -import com.withorb.api.models.CustomerFetchByExternalIdParams -import com.withorb.api.models.CustomerFetchParams -import com.withorb.api.models.CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams -import com.withorb.api.models.CustomerSyncPaymentMethodsFromGatewayParams import com.withorb.api.models.CustomerUpdateByExternalIdParams import com.withorb.api.models.CustomerUpdateParams import org.junit.jupiter.api.Test @@ -219,10 +214,7 @@ internal class CustomerServiceAsyncTest { .build() val customerServiceAsync = client.customers() - val future = - customerServiceAsync.delete( - CustomerDeleteParams.builder().customerId("customer_id").build() - ) + val future = customerServiceAsync.delete("customer_id") val response = future.get() } @@ -236,10 +228,7 @@ internal class CustomerServiceAsyncTest { .build() val customerServiceAsync = client.customers() - val customerFuture = - customerServiceAsync.fetch( - CustomerFetchParams.builder().customerId("customer_id").build() - ) + val customerFuture = customerServiceAsync.fetch("customer_id") val customer = customerFuture.get() customer.validate() @@ -254,12 +243,7 @@ internal class CustomerServiceAsyncTest { .build() val customerServiceAsync = client.customers() - val customerFuture = - customerServiceAsync.fetchByExternalId( - CustomerFetchByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val customerFuture = customerServiceAsync.fetchByExternalId("external_customer_id") val customer = customerFuture.get() customer.validate() @@ -274,12 +258,7 @@ internal class CustomerServiceAsyncTest { .build() val customerServiceAsync = client.customers() - val future = - customerServiceAsync.syncPaymentMethodsFromGateway( - CustomerSyncPaymentMethodsFromGatewayParams.builder() - .customerId("customer_id") - .build() - ) + val future = customerServiceAsync.syncPaymentMethodsFromGateway("customer_id") val response = future.get() } @@ -295,9 +274,7 @@ internal class CustomerServiceAsyncTest { val future = customerServiceAsync.syncPaymentMethodsFromGatewayByExternalCustomerId( - CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() - .externalCustomerId("external_customer_id") - .build() + "external_customer_id" ) val response = future.get() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt index 17734966d..2eb8b99a4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt @@ -6,7 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.DimensionalPriceGroupCreateParams -import com.withorb.api.models.DimensionalPriceGroupRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -52,11 +51,7 @@ internal class DimensionalPriceGroupServiceAsyncTest { val dimensionalPriceGroupServiceAsync = client.dimensionalPriceGroups() val dimensionalPriceGroupFuture = - dimensionalPriceGroupServiceAsync.retrieve( - DimensionalPriceGroupRetrieveParams.builder() - .dimensionalPriceGroupId("dimensional_price_group_id") - .build() - ) + dimensionalPriceGroupServiceAsync.retrieve("dimensional_price_group_id") val dimensionalPriceGroup = dimensionalPriceGroupFuture.get() dimensionalPriceGroup.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt index 034c78e63..9f2113efb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.async import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue -import com.withorb.api.models.EventDeprecateParams import com.withorb.api.models.EventIngestParams import com.withorb.api.models.EventSearchParams import com.withorb.api.models.EventUpdateParams @@ -50,8 +49,7 @@ internal class EventServiceAsyncTest { .build() val eventServiceAsync = client.events() - val responseFuture = - eventServiceAsync.deprecate(EventDeprecateParams.builder().eventId("event_id").build()) + val responseFuture = eventServiceAsync.deprecate("event_id") val response = responseFuture.get() response.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt index adac43731..ddf203705 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt @@ -6,13 +6,10 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.InvoiceCreateParams -import com.withorb.api.models.InvoiceFetchParams import com.withorb.api.models.InvoiceFetchUpcomingParams import com.withorb.api.models.InvoiceIssueParams import com.withorb.api.models.InvoiceMarkPaidParams -import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams -import com.withorb.api.models.InvoiceVoidInvoiceParams import com.withorb.api.models.PercentageDiscount import java.time.LocalDate import java.time.OffsetDateTime @@ -126,8 +123,7 @@ internal class InvoiceServiceAsyncTest { .build() val invoiceServiceAsync = client.invoices() - val invoiceFuture = - invoiceServiceAsync.fetch(InvoiceFetchParams.builder().invoiceId("invoice_id").build()) + val invoiceFuture = invoiceServiceAsync.fetch("invoice_id") val invoice = invoiceFuture.get() invoice.validate() @@ -201,8 +197,7 @@ internal class InvoiceServiceAsyncTest { .build() val invoiceServiceAsync = client.invoices() - val invoiceFuture = - invoiceServiceAsync.pay(InvoicePayParams.builder().invoiceId("invoice_id").build()) + val invoiceFuture = invoiceServiceAsync.pay("invoice_id") val invoice = invoiceFuture.get() invoice.validate() @@ -217,10 +212,7 @@ internal class InvoiceServiceAsyncTest { .build() val invoiceServiceAsync = client.invoices() - val invoiceFuture = - invoiceServiceAsync.voidInvoice( - InvoiceVoidInvoiceParams.builder().invoiceId("invoice_id").build() - ) + val invoiceFuture = invoiceServiceAsync.voidInvoice("invoice_id") val invoice = invoiceFuture.get() invoice.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt index be1bd1554..113d1deeb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.async import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.models.ItemCreateParams -import com.withorb.api.models.ItemFetchParams import com.withorb.api.models.ItemUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -82,7 +81,7 @@ internal class ItemServiceAsyncTest { .build() val itemServiceAsync = client.items() - val itemFuture = itemServiceAsync.fetch(ItemFetchParams.builder().itemId("item_id").build()) + val itemFuture = itemServiceAsync.fetch("item_id") val item = itemFuture.get() item.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt index 7aa9182b6..baa06b68f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt @@ -6,7 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.MetricCreateParams -import com.withorb.api.models.MetricFetchParams import com.withorb.api.models.MetricUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -91,8 +90,7 @@ internal class MetricServiceAsyncTest { .build() val metricServiceAsync = client.metrics() - val billableMetricFuture = - metricServiceAsync.fetch(MetricFetchParams.builder().metricId("metric_id").build()) + val billableMetricFuture = metricServiceAsync.fetch("metric_id") val billableMetric = billableMetricFuture.get() billableMetric.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt index 762e41da4..b6cfed26b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt @@ -6,7 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.PlanCreateParams -import com.withorb.api.models.PlanFetchParams import com.withorb.api.models.PlanUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -142,7 +141,7 @@ internal class PlanServiceAsyncTest { .build() val planServiceAsync = client.plans() - val planFuture = planServiceAsync.fetch(PlanFetchParams.builder().planId("plan_id").build()) + val planFuture = planServiceAsync.fetch("plan_id") val plan = planFuture.get() plan.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt index 4916bcea1..03870fb82 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt @@ -7,7 +7,6 @@ import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.PriceCreateParams import com.withorb.api.models.PriceEvaluateParams -import com.withorb.api.models.PriceFetchParams import com.withorb.api.models.PriceUpdateParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -160,8 +159,7 @@ internal class PriceServiceAsyncTest { .build() val priceServiceAsync = client.prices() - val priceFuture = - priceServiceAsync.fetch(PriceFetchParams.builder().priceId("price_id").build()) + val priceFuture = priceServiceAsync.fetch("price_id") val price = priceFuture.get() price.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncTest.kt index 00fb85f9e..3c74803f6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncTest.kt @@ -5,8 +5,6 @@ package com.withorb.api.services.async import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.models.SubscriptionChangeApplyParams -import com.withorb.api.models.SubscriptionChangeCancelParams -import com.withorb.api.models.SubscriptionChangeRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,11 +21,7 @@ internal class SubscriptionChangeServiceAsyncTest { val subscriptionChangeServiceAsync = client.subscriptionChanges() val subscriptionChangeFuture = - subscriptionChangeServiceAsync.retrieve( - SubscriptionChangeRetrieveParams.builder() - .subscriptionChangeId("subscription_change_id") - .build() - ) + subscriptionChangeServiceAsync.retrieve("subscription_change_id") val subscriptionChange = subscriptionChangeFuture.get() subscriptionChange.validate() @@ -64,12 +58,7 @@ internal class SubscriptionChangeServiceAsyncTest { .build() val subscriptionChangeServiceAsync = client.subscriptionChanges() - val responseFuture = - subscriptionChangeServiceAsync.cancel( - SubscriptionChangeCancelParams.builder() - .subscriptionChangeId("subscription_change_id") - .build() - ) + val responseFuture = subscriptionChangeServiceAsync.cancel("subscription_change_id") val response = responseFuture.get() response.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt index c24a19b46..01ea6b855 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt @@ -8,15 +8,11 @@ import com.withorb.api.core.JsonValue import com.withorb.api.models.SubscriptionCancelParams import com.withorb.api.models.SubscriptionCreateParams import com.withorb.api.models.SubscriptionFetchCostsParams -import com.withorb.api.models.SubscriptionFetchParams -import com.withorb.api.models.SubscriptionFetchScheduleParams import com.withorb.api.models.SubscriptionFetchUsageParams import com.withorb.api.models.SubscriptionPriceIntervalsParams import com.withorb.api.models.SubscriptionSchedulePlanChangeParams import com.withorb.api.models.SubscriptionTriggerPhaseParams -import com.withorb.api.models.SubscriptionUnscheduleCancellationParams import com.withorb.api.models.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams -import com.withorb.api.models.SubscriptionUnschedulePendingPlanChangesParams import com.withorb.api.models.SubscriptionUpdateFixedFeeQuantityParams import com.withorb.api.models.SubscriptionUpdateParams import com.withorb.api.models.SubscriptionUpdateTrialParams @@ -402,10 +398,7 @@ internal class SubscriptionServiceAsyncTest { .build() val subscriptionServiceAsync = client.subscriptions() - val subscriptionFuture = - subscriptionServiceAsync.fetch( - SubscriptionFetchParams.builder().subscriptionId("subscription_id").build() - ) + val subscriptionFuture = subscriptionServiceAsync.fetch("subscription_id") val subscription = subscriptionFuture.get() subscription.validate() @@ -444,10 +437,7 @@ internal class SubscriptionServiceAsyncTest { .build() val subscriptionServiceAsync = client.subscriptions() - val pageFuture = - subscriptionServiceAsync.fetchSchedule( - SubscriptionFetchScheduleParams.builder().subscriptionId("subscription_id").build() - ) + val pageFuture = subscriptionServiceAsync.fetchSchedule("subscription_id") val page = pageFuture.get() page.response().validate() @@ -977,12 +967,7 @@ internal class SubscriptionServiceAsyncTest { .build() val subscriptionServiceAsync = client.subscriptions() - val responseFuture = - subscriptionServiceAsync.unscheduleCancellation( - SubscriptionUnscheduleCancellationParams.builder() - .subscriptionId("subscription_id") - .build() - ) + val responseFuture = subscriptionServiceAsync.unscheduleCancellation("subscription_id") val response = responseFuture.get() response.validate() @@ -1019,11 +1004,7 @@ internal class SubscriptionServiceAsyncTest { val subscriptionServiceAsync = client.subscriptions() val responseFuture = - subscriptionServiceAsync.unschedulePendingPlanChanges( - SubscriptionUnschedulePendingPlanChangesParams.builder() - .subscriptionId("subscription_id") - .build() - ) + subscriptionServiceAsync.unschedulePendingPlanChanges("subscription_id") val response = responseFuture.get() response.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt index a11e29a14..30a1fa047 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt @@ -4,7 +4,6 @@ package com.withorb.api.services.async.coupons import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync -import com.withorb.api.models.CouponSubscriptionListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -20,10 +19,7 @@ internal class SubscriptionServiceAsyncTest { .build() val subscriptionServiceAsync = client.coupons().subscriptions() - val pageFuture = - subscriptionServiceAsync.list( - CouponSubscriptionListParams.builder().couponId("coupon_id").build() - ) + val pageFuture = subscriptionServiceAsync.list("coupon_id") val page = pageFuture.get() page.response().validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt index 47afac585..d23fd4d99 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.async.customers import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.models.CustomerBalanceTransactionCreateParams -import com.withorb.api.models.CustomerBalanceTransactionListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -44,10 +43,7 @@ internal class BalanceTransactionServiceAsyncTest { .build() val balanceTransactionServiceAsync = client.customers().balanceTransactions() - val pageFuture = - balanceTransactionServiceAsync.list( - CustomerBalanceTransactionListParams.builder().customerId("customer_id").build() - ) + val pageFuture = balanceTransactionServiceAsync.list("customer_id") val page = pageFuture.get() page.response().validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt index 2a9e925cb..fd36b268e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt @@ -4,8 +4,6 @@ package com.withorb.api.services.async.customers import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync -import com.withorb.api.models.CustomerCreditListByExternalIdParams -import com.withorb.api.models.CustomerCreditListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -21,10 +19,7 @@ internal class CreditServiceAsyncTest { .build() val creditServiceAsync = client.customers().credits() - val pageFuture = - creditServiceAsync.list( - CustomerCreditListParams.builder().customerId("customer_id").build() - ) + val pageFuture = creditServiceAsync.list("customer_id") val page = pageFuture.get() page.response().validate() @@ -39,12 +34,7 @@ internal class CreditServiceAsyncTest { .build() val creditServiceAsync = client.customers().credits() - val pageFuture = - creditServiceAsync.listByExternalId( - CustomerCreditListByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val pageFuture = creditServiceAsync.listByExternalId("external_customer_id") val page = pageFuture.get() page.response().validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt index 61e61c4b5..8e57daf04 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt @@ -7,8 +7,6 @@ import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.CustomerCreditLedgerCreateEntryByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerCreateEntryParams -import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams -import com.withorb.api.models.CustomerCreditLedgerListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -25,10 +23,7 @@ internal class LedgerServiceAsyncTest { .build() val ledgerServiceAsync = client.customers().credits().ledger() - val pageFuture = - ledgerServiceAsync.list( - CustomerCreditLedgerListParams.builder().customerId("customer_id").build() - ) + val pageFuture = ledgerServiceAsync.list("customer_id") val page = pageFuture.get() page.response().validate() @@ -145,12 +140,7 @@ internal class LedgerServiceAsyncTest { .build() val ledgerServiceAsync = client.customers().credits().ledger() - val pageFuture = - ledgerServiceAsync.listByExternalId( - CustomerCreditLedgerListByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val pageFuture = ledgerServiceAsync.listByExternalId("external_customer_id") val page = pageFuture.get() page.response().validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt index de7dbfa5c..55f1cf4a6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt @@ -8,8 +8,6 @@ import com.withorb.api.models.CustomerCreditTopUpCreateByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpCreateParams import com.withorb.api.models.CustomerCreditTopUpDeleteByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpDeleteParams -import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams -import com.withorb.api.models.CustomerCreditTopUpListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -61,10 +59,7 @@ internal class TopUpServiceAsyncTest { .build() val topUpServiceAsync = client.customers().credits().topUps() - val pageFuture = - topUpServiceAsync.list( - CustomerCreditTopUpListParams.builder().customerId("customer_id").build() - ) + val pageFuture = topUpServiceAsync.list("customer_id") val page = pageFuture.get() page.response().validate() @@ -156,12 +151,7 @@ internal class TopUpServiceAsyncTest { .build() val topUpServiceAsync = client.customers().credits().topUps() - val pageFuture = - topUpServiceAsync.listByExternalId( - CustomerCreditTopUpListByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val pageFuture = topUpServiceAsync.listByExternalId("external_customer_id") val page = pageFuture.get() page.response().validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt index 15c364daa..7a286bbe4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt @@ -4,7 +4,6 @@ package com.withorb.api.services.async.dimensionalPriceGroups import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync -import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,9 +22,7 @@ internal class ExternalDimensionalPriceGroupIdServiceAsyncTest { val dimensionalPriceGroupFuture = externalDimensionalPriceGroupIdServiceAsync.retrieve( - DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.builder() - .externalDimensionalPriceGroupId("external_dimensional_price_group_id") - .build() + "external_dimensional_price_group_id" ) val dimensionalPriceGroup = dimensionalPriceGroupFuture.get() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt index 3fc16ab4b..efed68fd2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt @@ -4,10 +4,7 @@ package com.withorb.api.services.async.events import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync -import com.withorb.api.models.EventBackfillCloseParams import com.withorb.api.models.EventBackfillCreateParams -import com.withorb.api.models.EventBackfillFetchParams -import com.withorb.api.models.EventBackfillRevertParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -65,10 +62,7 @@ internal class BackfillServiceAsyncTest { .build() val backfillServiceAsync = client.events().backfills() - val responseFuture = - backfillServiceAsync.close( - EventBackfillCloseParams.builder().backfillId("backfill_id").build() - ) + val responseFuture = backfillServiceAsync.close("backfill_id") val response = responseFuture.get() response.validate() @@ -83,10 +77,7 @@ internal class BackfillServiceAsyncTest { .build() val backfillServiceAsync = client.events().backfills() - val responseFuture = - backfillServiceAsync.fetch( - EventBackfillFetchParams.builder().backfillId("backfill_id").build() - ) + val responseFuture = backfillServiceAsync.fetch("backfill_id") val response = responseFuture.get() response.validate() @@ -101,10 +92,7 @@ internal class BackfillServiceAsyncTest { .build() val backfillServiceAsync = client.events().backfills() - val responseFuture = - backfillServiceAsync.revert( - EventBackfillRevertParams.builder().backfillId("backfill_id").build() - ) + val responseFuture = backfillServiceAsync.revert("backfill_id") val response = responseFuture.get() response.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt index 3990a1754..c600a995b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.async.plans import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue -import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -48,10 +47,7 @@ internal class ExternalPlanIdServiceAsyncTest { .build() val externalPlanIdServiceAsync = client.plans().externalPlanId() - val planFuture = - externalPlanIdServiceAsync.fetch( - PlanExternalPlanIdFetchParams.builder().externalPlanId("external_plan_id").build() - ) + val planFuture = externalPlanIdServiceAsync.fetch("external_plan_id") val plan = planFuture.get() plan.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt index a73cc6919..c01a21b5b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.async.prices import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue -import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -47,12 +46,7 @@ internal class ExternalPriceIdServiceAsyncTest { .build() val externalPriceIdServiceAsync = client.prices().externalPriceId() - val priceFuture = - externalPriceIdServiceAsync.fetch( - PriceExternalPriceIdFetchParams.builder() - .externalPriceId("external_price_id") - .build() - ) + val priceFuture = externalPriceIdServiceAsync.fetch("external_price_id") val price = priceFuture.get() price.validate() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt index 479a9eaee..015b5f2b9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt @@ -9,7 +9,6 @@ import com.withorb.api.models.AlertCreateForExternalCustomerParams import com.withorb.api.models.AlertCreateForSubscriptionParams import com.withorb.api.models.AlertDisableParams import com.withorb.api.models.AlertEnableParams -import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -27,7 +26,7 @@ internal class AlertServiceTest { .build() val alertService = client.alerts() - val alert = alertService.retrieve(AlertRetrieveParams.builder().alertId("alert_id").build()) + val alert = alertService.retrieve("alert_id") alert.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt index cd0ceeff8..ca0538b54 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt @@ -4,9 +4,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient -import com.withorb.api.models.CouponArchiveParams import com.withorb.api.models.CouponCreateParams -import com.withorb.api.models.CouponFetchParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -58,8 +56,7 @@ internal class CouponServiceTest { .build() val couponService = client.coupons() - val coupon = - couponService.archive(CouponArchiveParams.builder().couponId("coupon_id").build()) + val coupon = couponService.archive("coupon_id") coupon.validate() } @@ -73,7 +70,7 @@ internal class CouponServiceTest { .build() val couponService = client.coupons() - val coupon = couponService.fetch(CouponFetchParams.builder().couponId("coupon_id").build()) + val coupon = couponService.fetch("coupon_id") coupon.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt index 1e1f88b3b..57a5ee0a6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.models.CreditNoteCreateParams -import com.withorb.api.models.CreditNoteFetchParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -61,10 +60,7 @@ internal class CreditNoteServiceTest { .build() val creditNoteService = client.creditNotes() - val creditNote = - creditNoteService.fetch( - CreditNoteFetchParams.builder().creditNoteId("credit_note_id").build() - ) + val creditNote = creditNoteService.fetch("credit_note_id") creditNote.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt index 51798b96b..f7b5d6b4b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt @@ -6,11 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.CustomerCreateParams -import com.withorb.api.models.CustomerDeleteParams -import com.withorb.api.models.CustomerFetchByExternalIdParams -import com.withorb.api.models.CustomerFetchParams -import com.withorb.api.models.CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams -import com.withorb.api.models.CustomerSyncPaymentMethodsFromGatewayParams import com.withorb.api.models.CustomerUpdateByExternalIdParams import com.withorb.api.models.CustomerUpdateParams import org.junit.jupiter.api.Test @@ -216,7 +211,7 @@ internal class CustomerServiceTest { .build() val customerService = client.customers() - customerService.delete(CustomerDeleteParams.builder().customerId("customer_id").build()) + customerService.delete("customer_id") } @Test @@ -228,8 +223,7 @@ internal class CustomerServiceTest { .build() val customerService = client.customers() - val customer = - customerService.fetch(CustomerFetchParams.builder().customerId("customer_id").build()) + val customer = customerService.fetch("customer_id") customer.validate() } @@ -243,12 +237,7 @@ internal class CustomerServiceTest { .build() val customerService = client.customers() - val customer = - customerService.fetchByExternalId( - CustomerFetchByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val customer = customerService.fetchByExternalId("external_customer_id") customer.validate() } @@ -262,9 +251,7 @@ internal class CustomerServiceTest { .build() val customerService = client.customers() - customerService.syncPaymentMethodsFromGateway( - CustomerSyncPaymentMethodsFromGatewayParams.builder().customerId("customer_id").build() - ) + customerService.syncPaymentMethodsFromGateway("customer_id") } @Test @@ -276,11 +263,7 @@ internal class CustomerServiceTest { .build() val customerService = client.customers() - customerService.syncPaymentMethodsFromGatewayByExternalCustomerId( - CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + customerService.syncPaymentMethodsFromGatewayByExternalCustomerId("external_customer_id") } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt index 253d23057..8b74b1d23 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt @@ -6,7 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.DimensionalPriceGroupCreateParams -import com.withorb.api.models.DimensionalPriceGroupRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -51,11 +50,7 @@ internal class DimensionalPriceGroupServiceTest { val dimensionalPriceGroupService = client.dimensionalPriceGroups() val dimensionalPriceGroup = - dimensionalPriceGroupService.retrieve( - DimensionalPriceGroupRetrieveParams.builder() - .dimensionalPriceGroupId("dimensional_price_group_id") - .build() - ) + dimensionalPriceGroupService.retrieve("dimensional_price_group_id") dimensionalPriceGroup.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt index c6a90eb2c..0fd938bcb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue -import com.withorb.api.models.EventDeprecateParams import com.withorb.api.models.EventIngestParams import com.withorb.api.models.EventSearchParams import com.withorb.api.models.EventUpdateParams @@ -49,8 +48,7 @@ internal class EventServiceTest { .build() val eventService = client.events() - val response = - eventService.deprecate(EventDeprecateParams.builder().eventId("event_id").build()) + val response = eventService.deprecate("event_id") response.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt index 50b47ed9c..548a40355 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt @@ -6,13 +6,10 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.InvoiceCreateParams -import com.withorb.api.models.InvoiceFetchParams import com.withorb.api.models.InvoiceFetchUpcomingParams import com.withorb.api.models.InvoiceIssueParams import com.withorb.api.models.InvoiceMarkPaidParams -import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams -import com.withorb.api.models.InvoiceVoidInvoiceParams import com.withorb.api.models.PercentageDiscount import java.time.LocalDate import java.time.OffsetDateTime @@ -123,8 +120,7 @@ internal class InvoiceServiceTest { .build() val invoiceService = client.invoices() - val invoice = - invoiceService.fetch(InvoiceFetchParams.builder().invoiceId("invoice_id").build()) + val invoice = invoiceService.fetch("invoice_id") invoice.validate() } @@ -194,7 +190,7 @@ internal class InvoiceServiceTest { .build() val invoiceService = client.invoices() - val invoice = invoiceService.pay(InvoicePayParams.builder().invoiceId("invoice_id").build()) + val invoice = invoiceService.pay("invoice_id") invoice.validate() } @@ -208,10 +204,7 @@ internal class InvoiceServiceTest { .build() val invoiceService = client.invoices() - val invoice = - invoiceService.voidInvoice( - InvoiceVoidInvoiceParams.builder().invoiceId("invoice_id").build() - ) + val invoice = invoiceService.voidInvoice("invoice_id") invoice.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt index 0822b77a5..cf712a8f5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.models.ItemCreateParams -import com.withorb.api.models.ItemFetchParams import com.withorb.api.models.ItemUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -78,7 +77,7 @@ internal class ItemServiceTest { .build() val itemService = client.items() - val item = itemService.fetch(ItemFetchParams.builder().itemId("item_id").build()) + val item = itemService.fetch("item_id") item.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt index f0939c314..3b18a5d05 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt @@ -6,7 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.MetricCreateParams -import com.withorb.api.models.MetricFetchParams import com.withorb.api.models.MetricUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -88,8 +87,7 @@ internal class MetricServiceTest { .build() val metricService = client.metrics() - val billableMetric = - metricService.fetch(MetricFetchParams.builder().metricId("metric_id").build()) + val billableMetric = metricService.fetch("metric_id") billableMetric.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt index 5e713d879..8b0b1099c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt @@ -6,7 +6,6 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.PlanCreateParams -import com.withorb.api.models.PlanFetchParams import com.withorb.api.models.PlanUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -139,7 +138,7 @@ internal class PlanServiceTest { .build() val planService = client.plans() - val plan = planService.fetch(PlanFetchParams.builder().planId("plan_id").build()) + val plan = planService.fetch("plan_id") plan.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt index 2951de27e..b1012c2ae 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt @@ -7,7 +7,6 @@ import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.PriceCreateParams import com.withorb.api.models.PriceEvaluateParams -import com.withorb.api.models.PriceFetchParams import com.withorb.api.models.PriceUpdateParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -156,7 +155,7 @@ internal class PriceServiceTest { .build() val priceService = client.prices() - val price = priceService.fetch(PriceFetchParams.builder().priceId("price_id").build()) + val price = priceService.fetch("price_id") price.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceTest.kt index 97151c51c..4fe649e82 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceTest.kt @@ -5,8 +5,6 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.models.SubscriptionChangeApplyParams -import com.withorb.api.models.SubscriptionChangeCancelParams -import com.withorb.api.models.SubscriptionChangeRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,12 +20,7 @@ internal class SubscriptionChangeServiceTest { .build() val subscriptionChangeService = client.subscriptionChanges() - val subscriptionChange = - subscriptionChangeService.retrieve( - SubscriptionChangeRetrieveParams.builder() - .subscriptionChangeId("subscription_change_id") - .build() - ) + val subscriptionChange = subscriptionChangeService.retrieve("subscription_change_id") subscriptionChange.validate() } @@ -62,12 +55,7 @@ internal class SubscriptionChangeServiceTest { .build() val subscriptionChangeService = client.subscriptionChanges() - val response = - subscriptionChangeService.cancel( - SubscriptionChangeCancelParams.builder() - .subscriptionChangeId("subscription_change_id") - .build() - ) + val response = subscriptionChangeService.cancel("subscription_change_id") response.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt index 351ee83c7..5c9408750 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt @@ -8,15 +8,11 @@ import com.withorb.api.core.JsonValue import com.withorb.api.models.SubscriptionCancelParams import com.withorb.api.models.SubscriptionCreateParams import com.withorb.api.models.SubscriptionFetchCostsParams -import com.withorb.api.models.SubscriptionFetchParams -import com.withorb.api.models.SubscriptionFetchScheduleParams import com.withorb.api.models.SubscriptionFetchUsageParams import com.withorb.api.models.SubscriptionPriceIntervalsParams import com.withorb.api.models.SubscriptionSchedulePlanChangeParams import com.withorb.api.models.SubscriptionTriggerPhaseParams -import com.withorb.api.models.SubscriptionUnscheduleCancellationParams import com.withorb.api.models.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams -import com.withorb.api.models.SubscriptionUnschedulePendingPlanChangesParams import com.withorb.api.models.SubscriptionUpdateFixedFeeQuantityParams import com.withorb.api.models.SubscriptionUpdateParams import com.withorb.api.models.SubscriptionUpdateTrialParams @@ -398,10 +394,7 @@ internal class SubscriptionServiceTest { .build() val subscriptionService = client.subscriptions() - val subscription = - subscriptionService.fetch( - SubscriptionFetchParams.builder().subscriptionId("subscription_id").build() - ) + val subscription = subscriptionService.fetch("subscription_id") subscription.validate() } @@ -438,10 +431,7 @@ internal class SubscriptionServiceTest { .build() val subscriptionService = client.subscriptions() - val page = - subscriptionService.fetchSchedule( - SubscriptionFetchScheduleParams.builder().subscriptionId("subscription_id").build() - ) + val page = subscriptionService.fetchSchedule("subscription_id") page.response().validate() } @@ -966,12 +956,7 @@ internal class SubscriptionServiceTest { .build() val subscriptionService = client.subscriptions() - val response = - subscriptionService.unscheduleCancellation( - SubscriptionUnscheduleCancellationParams.builder() - .subscriptionId("subscription_id") - .build() - ) + val response = subscriptionService.unscheduleCancellation("subscription_id") response.validate() } @@ -1005,12 +990,7 @@ internal class SubscriptionServiceTest { .build() val subscriptionService = client.subscriptions() - val response = - subscriptionService.unschedulePendingPlanChanges( - SubscriptionUnschedulePendingPlanChangesParams.builder() - .subscriptionId("subscription_id") - .build() - ) + val response = subscriptionService.unschedulePendingPlanChanges("subscription_id") response.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt index 7c781eb91..de8b4fe11 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt @@ -4,7 +4,6 @@ package com.withorb.api.services.blocking.coupons import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient -import com.withorb.api.models.CouponSubscriptionListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -20,10 +19,7 @@ internal class SubscriptionServiceTest { .build() val subscriptionService = client.coupons().subscriptions() - val page = - subscriptionService.list( - CouponSubscriptionListParams.builder().couponId("coupon_id").build() - ) + val page = subscriptionService.list("coupon_id") page.response().validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt index 7e4e5a11d..31278e925 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.blocking.customers import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.models.CustomerBalanceTransactionCreateParams -import com.withorb.api.models.CustomerBalanceTransactionListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -43,10 +42,7 @@ internal class BalanceTransactionServiceTest { .build() val balanceTransactionService = client.customers().balanceTransactions() - val page = - balanceTransactionService.list( - CustomerBalanceTransactionListParams.builder().customerId("customer_id").build() - ) + val page = balanceTransactionService.list("customer_id") page.response().validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt index 5254598fb..aceb4f89f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt @@ -4,8 +4,6 @@ package com.withorb.api.services.blocking.customers import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient -import com.withorb.api.models.CustomerCreditListByExternalIdParams -import com.withorb.api.models.CustomerCreditListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -21,8 +19,7 @@ internal class CreditServiceTest { .build() val creditService = client.customers().credits() - val page = - creditService.list(CustomerCreditListParams.builder().customerId("customer_id").build()) + val page = creditService.list("customer_id") page.response().validate() } @@ -36,12 +33,7 @@ internal class CreditServiceTest { .build() val creditService = client.customers().credits() - val page = - creditService.listByExternalId( - CustomerCreditListByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val page = creditService.listByExternalId("external_customer_id") page.response().validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt index 4b39618a1..85814fe9c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt @@ -7,8 +7,6 @@ import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.CustomerCreditLedgerCreateEntryByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerCreateEntryParams -import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams -import com.withorb.api.models.CustomerCreditLedgerListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -25,10 +23,7 @@ internal class LedgerServiceTest { .build() val ledgerService = client.customers().credits().ledger() - val page = - ledgerService.list( - CustomerCreditLedgerListParams.builder().customerId("customer_id").build() - ) + val page = ledgerService.list("customer_id") page.response().validate() } @@ -142,12 +137,7 @@ internal class LedgerServiceTest { .build() val ledgerService = client.customers().credits().ledger() - val page = - ledgerService.listByExternalId( - CustomerCreditLedgerListByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val page = ledgerService.listByExternalId("external_customer_id") page.response().validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt index eb9247ec4..4c3d2daaa 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt @@ -8,8 +8,6 @@ import com.withorb.api.models.CustomerCreditTopUpCreateByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpCreateParams import com.withorb.api.models.CustomerCreditTopUpDeleteByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpDeleteParams -import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams -import com.withorb.api.models.CustomerCreditTopUpListParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -60,10 +58,7 @@ internal class TopUpServiceTest { .build() val topUpService = client.customers().credits().topUps() - val page = - topUpService.list( - CustomerCreditTopUpListParams.builder().customerId("customer_id").build() - ) + val page = topUpService.list("customer_id") page.response().validate() } @@ -147,12 +142,7 @@ internal class TopUpServiceTest { .build() val topUpService = client.customers().credits().topUps() - val page = - topUpService.listByExternalId( - CustomerCreditTopUpListByExternalIdParams.builder() - .externalCustomerId("external_customer_id") - .build() - ) + val page = topUpService.listByExternalId("external_customer_id") page.response().validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt index 489d65b53..4831999e6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt @@ -4,7 +4,6 @@ package com.withorb.api.services.blocking.dimensionalPriceGroups import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient -import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,11 +21,7 @@ internal class ExternalDimensionalPriceGroupIdServiceTest { client.dimensionalPriceGroups().externalDimensionalPriceGroupId() val dimensionalPriceGroup = - externalDimensionalPriceGroupIdService.retrieve( - DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.builder() - .externalDimensionalPriceGroupId("external_dimensional_price_group_id") - .build() - ) + externalDimensionalPriceGroupIdService.retrieve("external_dimensional_price_group_id") dimensionalPriceGroup.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt index 4cbbe1823..62a9f2e34 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt @@ -4,10 +4,7 @@ package com.withorb.api.services.blocking.events import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient -import com.withorb.api.models.EventBackfillCloseParams import com.withorb.api.models.EventBackfillCreateParams -import com.withorb.api.models.EventBackfillFetchParams -import com.withorb.api.models.EventBackfillRevertParams import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -63,10 +60,7 @@ internal class BackfillServiceTest { .build() val backfillService = client.events().backfills() - val response = - backfillService.close( - EventBackfillCloseParams.builder().backfillId("backfill_id").build() - ) + val response = backfillService.close("backfill_id") response.validate() } @@ -80,10 +74,7 @@ internal class BackfillServiceTest { .build() val backfillService = client.events().backfills() - val response = - backfillService.fetch( - EventBackfillFetchParams.builder().backfillId("backfill_id").build() - ) + val response = backfillService.fetch("backfill_id") response.validate() } @@ -97,10 +88,7 @@ internal class BackfillServiceTest { .build() val backfillService = client.events().backfills() - val response = - backfillService.revert( - EventBackfillRevertParams.builder().backfillId("backfill_id").build() - ) + val response = backfillService.revert("backfill_id") response.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt index e904d7371..1dc620ee8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.blocking.plans import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue -import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -47,10 +46,7 @@ internal class ExternalPlanIdServiceTest { .build() val externalPlanIdService = client.plans().externalPlanId() - val plan = - externalPlanIdService.fetch( - PlanExternalPlanIdFetchParams.builder().externalPlanId("external_plan_id").build() - ) + val plan = externalPlanIdService.fetch("external_plan_id") plan.validate() } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt index b511ec595..71781f475 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt @@ -5,7 +5,6 @@ package com.withorb.api.services.blocking.prices import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue -import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -46,12 +45,7 @@ internal class ExternalPriceIdServiceTest { .build() val externalPriceIdService = client.prices().externalPriceId() - val price = - externalPriceIdService.fetch( - PriceExternalPriceIdFetchParams.builder() - .externalPriceId("external_price_id") - .build() - ) + val price = externalPriceIdService.fetch("external_price_id") price.validate() } From 9affbdee875bdf75fa150d58ed8de23b9d51eaf2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 00:01:24 +0000 Subject: [PATCH 13/18] feat(client)!: extract auto pagination to shared classes refactor(client)!: refactor async auto-pagination refactor(client)!: rename `getNextPage{,Params}` to `nextPage{,Params}` refactor(client)!: swap `nextPage{,Params}` to return non-optional # Migration - If you were referencing the `AutoPager` class on a specific `*Page` or `*PageAsync` type, then you should instead reference the shared `AutoPager` and `AutoPagerAsync` types, under the `core` package - `AutoPagerAsync` now has different usage. You can call `.subscribe(...)` on the returned object instead to get called back each page item. You can also call `onCompleteFuture()` to get a future that completes when all items have been processed. Finally, you can call `.close()` on the returned object to stop auto-paginating early - If you were referencing `getNextPage` or `getNextPageParams`: - Swap to `nextPage()` and `nextPageParams()` - Note that these both now return non-optional types (use `hasNextPage()` before calling these, since they will throw if it's impossible to get another page) There are examples and further information about pagination in the readme. --- README.md | 84 ++++-- .../api/client/okhttp/OrbOkHttpClient.kt | 5 + .../api/client/okhttp/OrbOkHttpClientAsync.kt | 5 + .../kotlin/com/withorb/api/core/AutoPager.kt | 21 ++ .../com/withorb/api/core/AutoPagerAsync.kt | 88 ++++++ .../com/withorb/api/core/ClientOptions.kt | 25 ++ .../main/kotlin/com/withorb/api/core/Page.kt | 33 +++ .../kotlin/com/withorb/api/core/PageAsync.kt | 35 +++ .../api/core/http/AsyncStreamResponse.kt | 157 ++++++++++ ...ntomReachableClosingAsyncStreamResponse.kt | 56 ++++ .../PhantomReachableClosingStreamResponse.kt | 21 ++ .../withorb/api/core/http/StreamResponse.kt | 19 ++ .../com/withorb/api/models/AlertListPage.kt | 55 +--- .../withorb/api/models/AlertListPageAsync.kt | 80 ++---- .../com/withorb/api/models/CouponListPage.kt | 55 +--- .../withorb/api/models/CouponListPageAsync.kt | 80 ++---- .../api/models/CouponSubscriptionListPage.kt | 56 +--- .../models/CouponSubscriptionListPageAsync.kt | 81 ++---- .../withorb/api/models/CreditNoteListPage.kt | 55 +--- .../api/models/CreditNoteListPageAsync.kt | 81 ++---- .../CustomerBalanceTransactionListPage.kt | 57 +--- ...CustomerBalanceTransactionListPageAsync.kt | 87 ++---- ...ustomerCreditLedgerListByExternalIdPage.kt | 58 +--- ...erCreditLedgerListByExternalIdPageAsync.kt | 88 ++---- .../models/CustomerCreditLedgerListPage.kt | 57 +--- .../CustomerCreditLedgerListPageAsync.kt | 85 ++---- .../CustomerCreditListByExternalIdPage.kt | 58 +--- ...CustomerCreditListByExternalIdPageAsync.kt | 87 ++---- .../api/models/CustomerCreditListPage.kt | 57 +--- .../api/models/CustomerCreditListPageAsync.kt | 85 ++---- ...CustomerCreditTopUpListByExternalIdPage.kt | 58 +--- ...merCreditTopUpListByExternalIdPageAsync.kt | 88 ++---- .../api/models/CustomerCreditTopUpListPage.kt | 57 +--- .../CustomerCreditTopUpListPageAsync.kt | 85 ++---- .../withorb/api/models/CustomerListPage.kt | 55 +--- .../api/models/CustomerListPageAsync.kt | 81 ++---- .../models/DimensionalPriceGroupListPage.kt | 57 +--- .../DimensionalPriceGroupListPageAsync.kt | 85 ++---- .../api/models/EventBackfillListPage.kt | 57 +--- .../api/models/EventBackfillListPageAsync.kt | 85 ++---- .../com/withorb/api/models/InvoiceListPage.kt | 55 +--- .../api/models/InvoiceListPageAsync.kt | 81 ++---- .../com/withorb/api/models/ItemListPage.kt | 55 +--- .../withorb/api/models/ItemListPageAsync.kt | 80 ++---- .../com/withorb/api/models/MetricListPage.kt | 55 +--- .../withorb/api/models/MetricListPageAsync.kt | 84 ++---- .../com/withorb/api/models/PlanListPage.kt | 55 +--- .../withorb/api/models/PlanListPageAsync.kt | 80 ++---- .../com/withorb/api/models/PriceListPage.kt | 55 +--- .../withorb/api/models/PriceListPageAsync.kt | 80 ++---- .../models/SubscriptionFetchSchedulePage.kt | 57 +--- .../SubscriptionFetchSchedulePageAsync.kt | 85 ++---- .../api/models/SubscriptionListPage.kt | 55 +--- .../api/models/SubscriptionListPageAsync.kt | 81 ++---- .../services/async/AlertServiceAsyncImpl.kt | 1 + .../services/async/CouponServiceAsyncImpl.kt | 1 + .../async/CreditNoteServiceAsyncImpl.kt | 1 + .../async/CustomerServiceAsyncImpl.kt | 1 + .../DimensionalPriceGroupServiceAsyncImpl.kt | 1 + .../services/async/InvoiceServiceAsyncImpl.kt | 1 + .../services/async/ItemServiceAsyncImpl.kt | 1 + .../services/async/MetricServiceAsyncImpl.kt | 1 + .../services/async/PlanServiceAsyncImpl.kt | 1 + .../services/async/PriceServiceAsyncImpl.kt | 1 + .../async/SubscriptionServiceAsyncImpl.kt | 2 + .../coupons/SubscriptionServiceAsyncImpl.kt | 1 + .../BalanceTransactionServiceAsyncImpl.kt | 1 + .../async/customers/CreditServiceAsyncImpl.kt | 2 + .../credits/LedgerServiceAsyncImpl.kt | 2 + .../credits/TopUpServiceAsyncImpl.kt | 2 + .../async/events/BackfillServiceAsyncImpl.kt | 1 + .../withorb/api/core/AutoPagerAsyncTest.kt | 182 ++++++++++++ .../com/withorb/api/core/AutoPagerTest.kt | 41 +++ .../api/core/http/AsyncStreamResponseTest.kt | 268 ++++++++++++++++++ 74 files changed, 1934 insertions(+), 2055 deletions(-) create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPager.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPagerAsync.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/Page.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/PageAsync.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/http/AsyncStreamResponse.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingStreamResponse.kt create mode 100644 orb-java-core/src/main/kotlin/com/withorb/api/core/http/StreamResponse.kt create mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerAsyncTest.kt create mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerTest.kt create mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/http/AsyncStreamResponseTest.kt diff --git a/README.md b/README.md index f77c081e2..d6e5ded06 100644 --- a/README.md +++ b/README.md @@ -215,53 +215,101 @@ The SDK throws custom unchecked exception types: ## Pagination -For methods that return a paginated list of results, this library provides convenient ways access the results either one page at a time, or item-by-item across all pages. +The SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages. ### Auto-pagination -To iterate through all results across all pages, you can use `autoPager`, which automatically handles fetching more pages for you: +To iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed. -### Synchronous +When using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html) ```java import com.withorb.api.models.Coupon; import com.withorb.api.models.CouponListPage; -// As an Iterable: -CouponListPage page = client.coupons().list(params); +CouponListPage page = client.coupons().list(); + +// Process as an Iterable for (Coupon coupon : page.autoPager()) { System.out.println(coupon); -}; +} -// As a Stream: -client.coupons().list(params).autoPager().stream() +// Process as a Stream +page.autoPager() + .stream() .limit(50) .forEach(coupon -> System.out.println(coupon)); ``` -### Asynchronous +When using the asynchronous client, the method returns an [`AsyncStreamResponse`](orb-java-core/src/main/kotlin/com/withorb/api/core/http/AsyncStreamResponse.kt): ```java -// Using forEach, which returns CompletableFuture: -asyncClient.coupons().list(params).autoPager() - .forEach(coupon -> System.out.println(coupon), executor); +import com.withorb.api.core.http.AsyncStreamResponse; +import com.withorb.api.models.Coupon; +import com.withorb.api.models.CouponListPageAsync; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +CompletableFuture pageFuture = client.async().coupons().list(); + +pageFuture.thenRun(page -> page.autoPager().subscribe(coupon -> { + System.out.println(coupon); +})); + +// If you need to handle errors or completion of the stream +pageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() { + @Override + public void onNext(Coupon coupon) { + System.out.println(coupon); + } + + @Override + public void onComplete(Optional error) { + if (error.isPresent()) { + System.out.println("Something went wrong!"); + throw new RuntimeException(error.get()); + } else { + System.out.println("No more!"); + } + } +})); + +// Or use futures +pageFuture.thenRun(page -> page.autoPager() + .subscribe(coupon -> { + System.out.println(coupon); + }) + .onCompleteFuture() + .whenComplete((unused, error) -> { + if (error != null) { + System.out.println("Something went wrong!"); + throw new RuntimeException(error); + } else { + System.out.println("No more!"); + } + })); ``` ### Manual pagination -If none of the above helpers meet your needs, you can also manually request pages one-by-one. A page of results has a `data()` method to fetch the list of objects, as well as top-level `response` and other methods to fetch top-level data about the page. It also has methods `hasNextPage`, `getNextPage`, and `getNextPageParams` methods to help with pagination. +To access individual page items and manually request the next page, use the `items()`, +`hasNextPage()`, and `nextPage()` methods: ```java import com.withorb.api.models.Coupon; import com.withorb.api.models.CouponListPage; -CouponListPage page = client.coupons().list(params); -while (page != null) { - for (Coupon coupon : page.data()) { +CouponListPage page = client.coupons().list(); +while (true) { + for (Coupon coupon : page.items()) { System.out.println(coupon); } - page = page.getNextPage().orElse(null); + if (!page.hasNextPage()) { + break; + } + + page = page.nextPage(); } ``` @@ -338,7 +386,6 @@ To set a custom timeout, configure the method call using the `timeout` method: ```java import com.withorb.api.models.Customer; -import com.withorb.api.models.CustomerCreateParams; Customer customer = client.customers().create( params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() @@ -587,7 +634,6 @@ Or configure the method call to validate the response using the `responseValidat ```java import com.withorb.api.models.Customer; -import com.withorb.api.models.CustomerCreateParams; Customer customer = client.customers().create( params, RequestOptions.builder().responseValidation(true).build() 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 458d3da86..df13e8b12 100644 --- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt +++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt @@ -13,6 +13,7 @@ import java.net.Proxy import java.time.Clock import java.time.Duration import java.util.Optional +import java.util.concurrent.Executor import kotlin.jvm.optionals.getOrNull class OrbOkHttpClient private constructor() { @@ -47,6 +48,10 @@ class OrbOkHttpClient private constructor() { fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + clientOptions.streamHandlerExecutor(streamHandlerExecutor) + } + fun clock(clock: Clock) = apply { clientOptions.clock(clock) } fun headers(headers: Headers) = apply { clientOptions.headers(headers) } 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 f8d51c09e..b0396fb64 100644 --- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt +++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt @@ -13,6 +13,7 @@ import java.net.Proxy import java.time.Clock import java.time.Duration import java.util.Optional +import java.util.concurrent.Executor import kotlin.jvm.optionals.getOrNull class OrbOkHttpClientAsync private constructor() { @@ -47,6 +48,10 @@ class OrbOkHttpClientAsync private constructor() { fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + clientOptions.streamHandlerExecutor(streamHandlerExecutor) + } + fun clock(clock: Clock) = apply { clientOptions.clock(clock) } fun headers(headers: Headers) = apply { clientOptions.headers(headers) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPager.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPager.kt new file mode 100644 index 000000000..87762a7c5 --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPager.kt @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +import java.util.stream.Stream +import java.util.stream.StreamSupport + +class AutoPager private constructor(private val firstPage: Page) : Iterable { + + companion object { + + fun from(firstPage: Page): AutoPager = AutoPager(firstPage) + } + + override fun iterator(): Iterator = + generateSequence(firstPage) { if (it.hasNextPage()) it.nextPage() else null } + .flatMap { it.items() } + .iterator() + + fun stream(): Stream = StreamSupport.stream(spliterator(), false) +} diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPagerAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPagerAsync.kt new file mode 100644 index 000000000..beeade0a1 --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/AutoPagerAsync.kt @@ -0,0 +1,88 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +import com.withorb.api.core.http.AsyncStreamResponse +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletionException +import java.util.concurrent.Executor +import java.util.concurrent.atomic.AtomicReference + +class AutoPagerAsync +private constructor(private val firstPage: PageAsync, private val defaultExecutor: Executor) : + AsyncStreamResponse { + + companion object { + + fun from(firstPage: PageAsync, defaultExecutor: Executor): AutoPagerAsync = + AutoPagerAsync(firstPage, defaultExecutor) + } + + private val onCompleteFuture = CompletableFuture() + private val state = AtomicReference(State.NEW) + + override fun subscribe(handler: AsyncStreamResponse.Handler): AsyncStreamResponse = + subscribe(handler, defaultExecutor) + + override fun subscribe( + handler: AsyncStreamResponse.Handler, + executor: Executor, + ): AsyncStreamResponse = apply { + // TODO(JDK): Use `compareAndExchange` once targeting JDK 9. + check(state.compareAndSet(State.NEW, State.SUBSCRIBED)) { + if (state.get() == State.SUBSCRIBED) "Cannot subscribe more than once" + else "Cannot subscribe after the response is closed" + } + + fun PageAsync.handle(): CompletableFuture { + if (state.get() == State.CLOSED) { + return CompletableFuture.completedFuture(null) + } + + items().forEach { handler.onNext(it) } + return if (hasNextPage()) nextPage().thenCompose { it.handle() } + else CompletableFuture.completedFuture(null) + } + + executor.execute { + firstPage.handle().whenComplete { _, error -> + val actualError = + if (error is CompletionException && error.cause != null) error.cause else error + try { + handler.onComplete(Optional.ofNullable(actualError)) + } finally { + try { + if (actualError == null) { + onCompleteFuture.complete(null) + } else { + onCompleteFuture.completeExceptionally(actualError) + } + } finally { + close() + } + } + } + } + } + + override fun onCompleteFuture(): CompletableFuture = onCompleteFuture + + override fun close() { + val previousState = state.getAndSet(State.CLOSED) + if (previousState == State.CLOSED) { + return + } + + // When the stream is closed, we should always consider it closed. If it closed due + // to an error, then we will have already completed the future earlier, and this + // will be a no-op. + onCompleteFuture.complete(null) + } +} + +private enum class State { + NEW, + SUBSCRIBED, + CLOSED, +} 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 33a561937..f1898f519 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt @@ -10,6 +10,10 @@ import com.withorb.api.core.http.QueryParams import com.withorb.api.core.http.RetryingHttpClient import java.time.Clock import java.util.Optional +import java.util.concurrent.Executor +import java.util.concurrent.Executors +import java.util.concurrent.ThreadFactory +import java.util.concurrent.atomic.AtomicLong import kotlin.jvm.optionals.getOrNull class ClientOptions @@ -18,6 +22,7 @@ private constructor( @get:JvmName("httpClient") val httpClient: HttpClient, @get:JvmName("checkJacksonVersionCompatibility") val checkJacksonVersionCompatibility: Boolean, @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, + @get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor, @get:JvmName("clock") val clock: Clock, @get:JvmName("baseUrl") val baseUrl: String, @get:JvmName("headers") val headers: Headers, @@ -63,6 +68,7 @@ private constructor( private var httpClient: HttpClient? = null private var checkJacksonVersionCompatibility: Boolean = true private var jsonMapper: JsonMapper = jsonMapper() + private var streamHandlerExecutor: Executor? = null private var clock: Clock = Clock.systemUTC() private var baseUrl: String = PRODUCTION_URL private var headers: Headers.Builder = Headers.builder() @@ -78,6 +84,7 @@ private constructor( httpClient = clientOptions.originalHttpClient checkJacksonVersionCompatibility = clientOptions.checkJacksonVersionCompatibility jsonMapper = clientOptions.jsonMapper + streamHandlerExecutor = clientOptions.streamHandlerExecutor clock = clientOptions.clock baseUrl = clientOptions.baseUrl headers = clientOptions.headers.toBuilder() @@ -97,6 +104,10 @@ private constructor( fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + fun clock(clock: Clock) = apply { this.clock = clock } fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } @@ -251,6 +262,20 @@ private constructor( ), checkJacksonVersionCompatibility, jsonMapper, + streamHandlerExecutor + ?: Executors.newCachedThreadPool( + object : ThreadFactory { + + private val threadFactory: ThreadFactory = + Executors.defaultThreadFactory() + private val count = AtomicLong(0) + + override fun newThread(runnable: Runnable): Thread = + threadFactory.newThread(runnable).also { + it.name = "orb-stream-handler-thread-${count.getAndIncrement()}" + } + } + ), clock, baseUrl, headers.build(), diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Page.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Page.kt new file mode 100644 index 000000000..ff2e880d8 --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Page.kt @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +/** + * An interface representing a single page, with items of type [T], from a paginated endpoint + * response. + * + * Implementations of this interface are expected to request additional pages synchronously. For + * asynchronous pagination, see the [PageAsync] interface. + */ +interface Page { + + /** + * Returns whether there's another page after this one. + * + * The method generally doesn't make requests so the result depends entirely on the data in this + * page. If a significant amount of time has passed between requesting this page and calling + * this method, then the result could be stale. + */ + fun hasNextPage(): Boolean + + /** + * Returns the page after this one by making another request. + * + * @throws IllegalStateException if it's impossible to get the next page. This exception is + * avoidable by calling [hasNextPage] first. + */ + fun nextPage(): Page + + /** Returns the items in this page. */ + fun items(): List +} diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/PageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/PageAsync.kt new file mode 100644 index 000000000..d97ddae03 --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/PageAsync.kt @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +import java.util.concurrent.CompletableFuture + +/** + * An interface representing a single page, with items of type [T], from a paginated endpoint + * response. + * + * Implementations of this interface are expected to request additional pages asynchronously. For + * synchronous pagination, see the [Page] interface. + */ +interface PageAsync { + + /** + * Returns whether there's another page after this one. + * + * The method generally doesn't make requests so the result depends entirely on the data in this + * page. If a significant amount of time has passed between requesting this page and calling + * this method, then the result could be stale. + */ + fun hasNextPage(): Boolean + + /** + * Returns the page after this one by making another request. + * + * @throws IllegalStateException if it's impossible to get the next page. This exception is + * avoidable by calling [hasNextPage] first. + */ + fun nextPage(): CompletableFuture> + + /** Returns the items in this page. */ + fun items(): List +} diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/AsyncStreamResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/AsyncStreamResponse.kt new file mode 100644 index 000000000..8b58fd92a --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/AsyncStreamResponse.kt @@ -0,0 +1,157 @@ +package com.withorb.api.core.http + +import com.withorb.api.core.http.AsyncStreamResponse.Handler +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor +import java.util.concurrent.atomic.AtomicReference + +/** + * A class providing access to an API response as an asynchronous stream of chunks of type [T], + * where each chunk can be individually processed as soon as it arrives instead of waiting on the + * full response. + */ +interface AsyncStreamResponse { + + /** + * Registers [handler] to be called for events of this stream. + * + * [handler]'s methods will be called in the client's configured or default thread pool. + * + * @throws IllegalStateException if [subscribe] has already been called. + */ + fun subscribe(handler: Handler): AsyncStreamResponse + + /** + * Registers [handler] to be called for events of this stream. + * + * [handler]'s methods will be called in the given [executor]. + * + * @throws IllegalStateException if [subscribe] has already been called. + */ + fun subscribe(handler: Handler, executor: Executor): AsyncStreamResponse + + /** + * Returns a future that completes when a stream is fully consumed, errors, or gets closed + * early. + */ + fun onCompleteFuture(): CompletableFuture + + /** + * Closes this resource, relinquishing any underlying resources. + * + * This is purposefully not inherited from [AutoCloseable] because this response should not be + * synchronously closed via try-with-resources. + */ + fun close() + + /** A class for handling streaming events. */ + fun interface Handler { + + /** Called whenever a chunk is received. */ + fun onNext(value: T) + + /** + * Called when a stream is fully consumed, errors, or gets closed early. + * + * [onNext] will not be called once this method is called. + * + * @param error Non-empty if the stream completed due to an error. + */ + fun onComplete(error: Optional) {} + } +} + +@JvmSynthetic +internal fun CompletableFuture>.toAsync(streamHandlerExecutor: Executor) = + PhantomReachableClosingAsyncStreamResponse( + object : AsyncStreamResponse { + + private val onCompleteFuture = CompletableFuture() + private val state = AtomicReference(State.NEW) + + init { + this@toAsync.whenComplete { _, error -> + // If an error occurs from the original future, then we should resolve the + // `onCompleteFuture` even if `subscribe` has not been called. + error?.let(onCompleteFuture::completeExceptionally) + } + } + + override fun subscribe(handler: Handler): AsyncStreamResponse = + subscribe(handler, streamHandlerExecutor) + + override fun subscribe( + handler: Handler, + executor: Executor, + ): AsyncStreamResponse = apply { + // TODO(JDK): Use `compareAndExchange` once targeting JDK 9. + check(state.compareAndSet(State.NEW, State.SUBSCRIBED)) { + if (state.get() == State.SUBSCRIBED) "Cannot subscribe more than once" + else "Cannot subscribe after the response is closed" + } + + this@toAsync.whenCompleteAsync( + { streamResponse, futureError -> + if (state.get() == State.CLOSED) { + // Avoid doing any work if `close` was called before the future + // completed. + return@whenCompleteAsync + } + + if (futureError != null) { + // An error occurred before we started passing chunks to the handler. + handler.onComplete(Optional.of(futureError)) + return@whenCompleteAsync + } + + var streamError: Throwable? = null + try { + streamResponse.stream().forEach(handler::onNext) + } catch (e: Throwable) { + streamError = e + } + + try { + handler.onComplete(Optional.ofNullable(streamError)) + } finally { + try { + // Notify completion via the `onCompleteFuture` as well. This is in + // a separate `try-finally` block so that we still complete the + // future if `handler.onComplete` throws. + if (streamError == null) { + onCompleteFuture.complete(null) + } else { + onCompleteFuture.completeExceptionally(streamError) + } + } finally { + close() + } + } + }, + executor, + ) + } + + override fun onCompleteFuture(): CompletableFuture = onCompleteFuture + + override fun close() { + val previousState = state.getAndSet(State.CLOSED) + if (previousState == State.CLOSED) { + return + } + + this@toAsync.whenComplete { streamResponse, error -> streamResponse?.close() } + // When the stream is closed, we should always consider it closed. If it closed due + // to an error, then we will have already completed the future earlier, and this + // will be a no-op. + onCompleteFuture.complete(null) + } + } + ) + +private enum class State { + NEW, + SUBSCRIBED, + CLOSED, +} diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt new file mode 100644 index 000000000..53a660b46 --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt @@ -0,0 +1,56 @@ +package com.withorb.api.core.http + +import com.withorb.api.core.closeWhenPhantomReachable +import com.withorb.api.core.http.AsyncStreamResponse.Handler +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor + +/** + * A delegating wrapper around an `AsyncStreamResponse` that closes it once it's only phantom + * reachable. + * + * This class ensures the `AsyncStreamResponse` is closed even if the user forgets to close it. + */ +internal class PhantomReachableClosingAsyncStreamResponse( + private val asyncStreamResponse: AsyncStreamResponse +) : AsyncStreamResponse { + + /** + * An object used for keeping `asyncStreamResponse` open while the object is still reachable. + */ + private val reachabilityTracker = Object() + + init { + closeWhenPhantomReachable(reachabilityTracker, asyncStreamResponse::close) + } + + override fun subscribe(handler: Handler): AsyncStreamResponse = apply { + asyncStreamResponse.subscribe(TrackedHandler(handler, reachabilityTracker)) + } + + override fun subscribe(handler: Handler, executor: Executor): AsyncStreamResponse = + apply { + asyncStreamResponse.subscribe(TrackedHandler(handler, reachabilityTracker), executor) + } + + override fun onCompleteFuture(): CompletableFuture = + asyncStreamResponse.onCompleteFuture() + + override fun close() = asyncStreamResponse.close() +} + +/** + * A wrapper around a `Handler` that also references a `reachabilityTracker` object. + * + * Referencing the `reachabilityTracker` object prevents it from getting reclaimed while the handler + * is still reachable. + */ +private class TrackedHandler( + private val handler: Handler, + private val reachabilityTracker: Any, +) : Handler { + override fun onNext(value: T) = handler.onNext(value) + + override fun onComplete(error: Optional) = handler.onComplete(error) +} diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingStreamResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingStreamResponse.kt new file mode 100644 index 000000000..161638dee --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingStreamResponse.kt @@ -0,0 +1,21 @@ +package com.withorb.api.core.http + +import com.withorb.api.core.closeWhenPhantomReachable +import java.util.stream.Stream + +/** + * A delegating wrapper around a `StreamResponse` that closes it once it's only phantom reachable. + * + * This class ensures the `StreamResponse` is closed even if the user forgets to close it. + */ +internal class PhantomReachableClosingStreamResponse( + private val streamResponse: StreamResponse +) : StreamResponse { + init { + closeWhenPhantomReachable(this, streamResponse) + } + + override fun stream(): Stream = streamResponse.stream() + + override fun close() = streamResponse.close() +} diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/StreamResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/StreamResponse.kt new file mode 100644 index 000000000..9c6597ff0 --- /dev/null +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/StreamResponse.kt @@ -0,0 +1,19 @@ +package com.withorb.api.core.http + +import java.util.stream.Stream + +interface StreamResponse : AutoCloseable { + + fun stream(): Stream + + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ + override fun close() +} + +@JvmSynthetic +internal fun StreamResponse.map(transform: (T) -> R): StreamResponse = + object : StreamResponse { + override fun stream(): Stream = this@map.stream().map(transform) + + override fun close() = this@map.close() + } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt index e34c1eaf8..626b3e7e6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.AlertService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [AlertService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: AlertService, private val params: AlertListParams, private val response: AlertListPageResponse, -) { +) : Page { /** * Delegates to [AlertListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): AlertListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): AlertListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): AlertListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: AlertListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt index 8a37ce8d4..ff9b12773 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.AlertServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [AlertServiceAsync.list] */ class AlertListPageAsync private constructor( private val service: AlertServiceAsync, + private val streamHandlerExecutor: Executor, private val params: AlertListParams, private val response: AlertListPageResponse, -) { +) : PageAsync { /** * Delegates to [AlertListPageResponse], but gracefully handles missing data. @@ -34,33 +36,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): AlertListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): AlertListParams = params @@ -78,6 +69,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +81,24 @@ private constructor( class Builder internal constructor() { private var service: AlertServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: AlertListParams? = null private var response: AlertListPageResponse? = null @JvmSynthetic internal fun from(alertListPageAsync: AlertListPageAsync) = apply { service = alertListPageAsync.service + streamHandlerExecutor = alertListPageAsync.streamHandlerExecutor params = alertListPageAsync.params response = alertListPageAsync.response } fun service(service: AlertServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: AlertListParams) = apply { this.params = params } @@ -115,6 +113,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +123,22 @@ private constructor( fun build(): AlertListPageAsync = AlertListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: AlertListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Alert) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is AlertListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is AlertListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "AlertListPageAsync{service=$service, params=$params, response=$response}" + "AlertListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt index 8fd79bede..54fa128c7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.CouponService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [CouponService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: CouponService, private val params: CouponListParams, private val response: CouponListPageResponse, -) { +) : Page { /** * Delegates to [CouponListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CouponListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): CouponListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CouponListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CouponListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt index 6486b6da2..884d7b629 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.CouponServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [CouponServiceAsync.list] */ class CouponListPageAsync private constructor( private val service: CouponServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CouponListParams, private val response: CouponListPageResponse, -) { +) : PageAsync { /** * Delegates to [CouponListPageResponse], but gracefully handles missing data. @@ -34,33 +36,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CouponListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CouponListParams = params @@ -78,6 +69,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +81,24 @@ private constructor( class Builder internal constructor() { private var service: CouponServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CouponListParams? = null private var response: CouponListPageResponse? = null @JvmSynthetic internal fun from(couponListPageAsync: CouponListPageAsync) = apply { service = couponListPageAsync.service + streamHandlerExecutor = couponListPageAsync.streamHandlerExecutor params = couponListPageAsync.params response = couponListPageAsync.response } fun service(service: CouponServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CouponListParams) = apply { this.params = params } @@ -115,6 +113,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +123,22 @@ private constructor( fun build(): CouponListPageAsync = CouponListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CouponListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Coupon) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CouponListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CouponListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CouponListPageAsync{service=$service, params=$params, response=$response}" + "CouponListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt index 77f174711..d81a7bb77 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.coupons.SubscriptionService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [SubscriptionService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: SubscriptionService, private val params: CouponSubscriptionListParams, private val response: Subscriptions, -) { +) : Page { /** * Delegates to [Subscriptions], but gracefully handles missing data. @@ -33,31 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CouponSubscriptionListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): CouponSubscriptionListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CouponSubscriptionListParams = params @@ -126,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CouponSubscriptionListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt index 47417e21c..afc243586 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.coupons.SubscriptionServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [SubscriptionServiceAsync.list] */ class CouponSubscriptionListPageAsync private constructor( private val service: SubscriptionServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CouponSubscriptionListParams, private val response: Subscriptions, -) { +) : PageAsync { /** * Delegates to [Subscriptions], but gracefully handles missing data. @@ -34,33 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CouponSubscriptionListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CouponSubscriptionListParams = params @@ -79,6 +71,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -90,6 +83,7 @@ private constructor( class Builder internal constructor() { private var service: SubscriptionServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CouponSubscriptionListParams? = null private var response: Subscriptions? = null @@ -97,12 +91,17 @@ private constructor( internal fun from(couponSubscriptionListPageAsync: CouponSubscriptionListPageAsync) = apply { service = couponSubscriptionListPageAsync.service + streamHandlerExecutor = couponSubscriptionListPageAsync.streamHandlerExecutor params = couponSubscriptionListPageAsync.params response = couponSubscriptionListPageAsync.response } fun service(service: SubscriptionServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CouponSubscriptionListParams) = apply { this.params = params } @@ -117,6 +116,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -126,47 +126,22 @@ private constructor( fun build(): CouponSubscriptionListPageAsync = CouponSubscriptionListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CouponSubscriptionListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Subscription) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CouponSubscriptionListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CouponSubscriptionListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CouponSubscriptionListPageAsync{service=$service, params=$params, response=$response}" + "CouponSubscriptionListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt index cbbd4f40b..a2337e3bd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.CreditNoteService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [CreditNoteService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: CreditNoteService, private val params: CreditNoteListParams, private val response: CreditNoteListPageResponse, -) { +) : Page { /** * Delegates to [CreditNoteListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CreditNoteListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): CreditNoteListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CreditNoteListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CreditNoteListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt index 104920cc9..3710fe7ee 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.CreditNoteServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [CreditNoteServiceAsync.list] */ class CreditNoteListPageAsync private constructor( private val service: CreditNoteServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CreditNoteListParams, private val response: CreditNoteListPageResponse, -) { +) : PageAsync { /** * Delegates to [CreditNoteListPageResponse], but gracefully handles missing data. @@ -34,33 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CreditNoteListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CreditNoteListParams = params @@ -78,6 +70,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +82,24 @@ private constructor( class Builder internal constructor() { private var service: CreditNoteServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CreditNoteListParams? = null private var response: CreditNoteListPageResponse? = null @JvmSynthetic internal fun from(creditNoteListPageAsync: CreditNoteListPageAsync) = apply { service = creditNoteListPageAsync.service + streamHandlerExecutor = creditNoteListPageAsync.streamHandlerExecutor params = creditNoteListPageAsync.params response = creditNoteListPageAsync.response } fun service(service: CreditNoteServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CreditNoteListParams) = apply { this.params = params } @@ -115,6 +114,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +124,22 @@ private constructor( fun build(): CreditNoteListPageAsync = CreditNoteListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CreditNoteListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CreditNote) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CreditNoteListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CreditNoteListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CreditNoteListPageAsync{service=$service, params=$params, response=$response}" + "CreditNoteListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt index a313acd6a..73d8e3bc5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.BalanceTransactionService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [BalanceTransactionService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: BalanceTransactionService, private val params: CustomerBalanceTransactionListParams, private val response: CustomerBalanceTransactionListPageResponse, -) { +) : Page { /** * Delegates to [CustomerBalanceTransactionListPageResponse], but gracefully handles missing @@ -36,31 +36,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerBalanceTransactionListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): CustomerBalanceTransactionListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerBalanceTransactionListParams = params @@ -133,26 +124,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerBalanceTransactionListPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt index 6214987f0..56c745f81 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.BalanceTransactionServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [BalanceTransactionServiceAsync.list] */ class CustomerBalanceTransactionListPageAsync private constructor( private val service: BalanceTransactionServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerBalanceTransactionListParams, private val response: CustomerBalanceTransactionListPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerBalanceTransactionListPageResponse], but gracefully handles missing @@ -37,33 +39,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerBalanceTransactionListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerBalanceTransactionListParams = params @@ -82,6 +75,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -93,6 +87,7 @@ private constructor( class Builder internal constructor() { private var service: BalanceTransactionServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerBalanceTransactionListParams? = null private var response: CustomerBalanceTransactionListPageResponse? = null @@ -101,12 +96,17 @@ private constructor( customerBalanceTransactionListPageAsync: CustomerBalanceTransactionListPageAsync ) = apply { service = customerBalanceTransactionListPageAsync.service + streamHandlerExecutor = customerBalanceTransactionListPageAsync.streamHandlerExecutor params = customerBalanceTransactionListPageAsync.params response = customerBalanceTransactionListPageAsync.response } fun service(service: BalanceTransactionServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerBalanceTransactionListParams) = apply { this.params = params } @@ -123,6 +123,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -132,52 +133,22 @@ private constructor( fun build(): CustomerBalanceTransactionListPageAsync = CustomerBalanceTransactionListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerBalanceTransactionListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerBalanceTransactionListResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList( - executor: Executor - ): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerBalanceTransactionListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransactionListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerBalanceTransactionListPageAsync{service=$service, params=$params, response=$response}" + "CustomerBalanceTransactionListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt index a791b9c6a..bc5f132ed 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.credits.LedgerService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [LedgerService.listByExternalId] */ @@ -16,7 +16,7 @@ private constructor( private val service: LedgerService, private val params: CustomerCreditLedgerListByExternalIdParams, private val response: CustomerCreditLedgerListByExternalIdPageResponse, -) { +) : Page { /** * Delegates to [CustomerCreditLedgerListByExternalIdPageResponse], but gracefully handles @@ -36,31 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditLedgerListByExternalIdParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.listByExternalId(it) } + override fun nextPage(): CustomerCreditLedgerListByExternalIdPage = + service.listByExternalId(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerCreditLedgerListByExternalIdParams = params @@ -136,26 +128,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerCreditLedgerListByExternalIdPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt index ce9a3b860..880a2a3af 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.credits.LedgerServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [LedgerServiceAsync.listByExternalId] */ class CustomerCreditLedgerListByExternalIdPageAsync private constructor( private val service: LedgerServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerCreditLedgerListByExternalIdParams, private val response: CustomerCreditLedgerListByExternalIdPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerCreditLedgerListByExternalIdPageResponse], but gracefully handles @@ -37,33 +39,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditLedgerListByExternalIdParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.listByExternalId(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.listByExternalId(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerCreditLedgerListByExternalIdParams = params @@ -82,6 +75,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -93,6 +87,7 @@ private constructor( class Builder internal constructor() { private var service: LedgerServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerCreditLedgerListByExternalIdParams? = null private var response: CustomerCreditLedgerListByExternalIdPageResponse? = null @@ -102,12 +97,18 @@ private constructor( CustomerCreditLedgerListByExternalIdPageAsync ) = apply { service = customerCreditLedgerListByExternalIdPageAsync.service + streamHandlerExecutor = + customerCreditLedgerListByExternalIdPageAsync.streamHandlerExecutor params = customerCreditLedgerListByExternalIdPageAsync.params response = customerCreditLedgerListByExternalIdPageAsync.response } fun service(service: LedgerServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerCreditLedgerListByExternalIdParams) = apply { this.params = params @@ -126,6 +127,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -135,52 +137,22 @@ private constructor( fun build(): CustomerCreditLedgerListByExternalIdPageAsync = CustomerCreditLedgerListByExternalIdPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerCreditLedgerListByExternalIdPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerCreditLedgerListByExternalIdResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList( - executor: Executor - ): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerListByExternalIdPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerListByExternalIdPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerCreditLedgerListByExternalIdPageAsync{service=$service, params=$params, response=$response}" + "CustomerCreditLedgerListByExternalIdPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt index b5b1fbb43..0d653fe2a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.credits.LedgerService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [LedgerService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: LedgerService, private val params: CustomerCreditLedgerListParams, private val response: CustomerCreditLedgerListPageResponse, -) { +) : Page { /** * Delegates to [CustomerCreditLedgerListPageResponse], but gracefully handles missing data. @@ -34,31 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditLedgerListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): CustomerCreditLedgerListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerCreditLedgerListParams = params @@ -129,26 +120,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerCreditLedgerListPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt index 31bb87655..b2659070f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.credits.LedgerServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [LedgerServiceAsync.list] */ class CustomerCreditLedgerListPageAsync private constructor( private val service: LedgerServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerCreditLedgerListParams, private val response: CustomerCreditLedgerListPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerCreditLedgerListPageResponse], but gracefully handles missing data. @@ -35,33 +37,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditLedgerListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerCreditLedgerListParams = params @@ -80,6 +73,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -91,6 +85,7 @@ private constructor( class Builder internal constructor() { private var service: LedgerServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerCreditLedgerListParams? = null private var response: CustomerCreditLedgerListPageResponse? = null @@ -98,12 +93,17 @@ private constructor( internal fun from(customerCreditLedgerListPageAsync: CustomerCreditLedgerListPageAsync) = apply { service = customerCreditLedgerListPageAsync.service + streamHandlerExecutor = customerCreditLedgerListPageAsync.streamHandlerExecutor params = customerCreditLedgerListPageAsync.params response = customerCreditLedgerListPageAsync.response } fun service(service: LedgerServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerCreditLedgerListParams) = apply { this.params = params } @@ -120,6 +120,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -129,50 +130,22 @@ private constructor( fun build(): CustomerCreditLedgerListPageAsync = CustomerCreditLedgerListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerCreditLedgerListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerCreditLedgerListResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerCreditLedgerListPageAsync{service=$service, params=$params, response=$response}" + "CustomerCreditLedgerListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt index c63f6aa65..7d2f73644 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.CreditService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [CreditService.listByExternalId] */ @@ -16,7 +16,7 @@ private constructor( private val service: CreditService, private val params: CustomerCreditListByExternalIdParams, private val response: CustomerCreditListByExternalIdPageResponse, -) { +) : Page { /** * Delegates to [CustomerCreditListByExternalIdPageResponse], but gracefully handles missing @@ -36,31 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditListByExternalIdParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.listByExternalId(it) } + override fun nextPage(): CustomerCreditListByExternalIdPage = + service.listByExternalId(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerCreditListByExternalIdParams = params @@ -133,26 +125,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerCreditListByExternalIdPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt index a15138b23..0fe94b19a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.CreditServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [CreditServiceAsync.listByExternalId] */ class CustomerCreditListByExternalIdPageAsync private constructor( private val service: CreditServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerCreditListByExternalIdParams, private val response: CustomerCreditListByExternalIdPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerCreditListByExternalIdPageResponse], but gracefully handles missing @@ -37,33 +39,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditListByExternalIdParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.listByExternalId(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.listByExternalId(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerCreditListByExternalIdParams = params @@ -82,6 +75,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -93,6 +87,7 @@ private constructor( class Builder internal constructor() { private var service: CreditServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerCreditListByExternalIdParams? = null private var response: CustomerCreditListByExternalIdPageResponse? = null @@ -101,12 +96,17 @@ private constructor( customerCreditListByExternalIdPageAsync: CustomerCreditListByExternalIdPageAsync ) = apply { service = customerCreditListByExternalIdPageAsync.service + streamHandlerExecutor = customerCreditListByExternalIdPageAsync.streamHandlerExecutor params = customerCreditListByExternalIdPageAsync.params response = customerCreditListByExternalIdPageAsync.response } fun service(service: CreditServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerCreditListByExternalIdParams) = apply { this.params = params } @@ -123,6 +123,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -132,52 +133,22 @@ private constructor( fun build(): CustomerCreditListByExternalIdPageAsync = CustomerCreditListByExternalIdPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerCreditListByExternalIdPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerCreditListByExternalIdResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList( - executor: Executor - ): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditListByExternalIdPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerCreditListByExternalIdPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerCreditListByExternalIdPageAsync{service=$service, params=$params, response=$response}" + "CustomerCreditListByExternalIdPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt index df86a0a8e..d24c2af5d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.CreditService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [CreditService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: CreditService, private val params: CustomerCreditListParams, private val response: CustomerCreditListPageResponse, -) { +) : Page { /** * Delegates to [CustomerCreditListPageResponse], but gracefully handles missing data. @@ -34,31 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): CustomerCreditListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerCreditListParams = params @@ -127,26 +118,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerCreditListPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt index 03272689b..ff22d0f2b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.CreditServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [CreditServiceAsync.list] */ class CustomerCreditListPageAsync private constructor( private val service: CreditServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerCreditListParams, private val response: CustomerCreditListPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerCreditListPageResponse], but gracefully handles missing data. @@ -35,33 +37,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerCreditListParams = params @@ -79,6 +72,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -90,18 +84,24 @@ private constructor( class Builder internal constructor() { private var service: CreditServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerCreditListParams? = null private var response: CustomerCreditListPageResponse? = null @JvmSynthetic internal fun from(customerCreditListPageAsync: CustomerCreditListPageAsync) = apply { service = customerCreditListPageAsync.service + streamHandlerExecutor = customerCreditListPageAsync.streamHandlerExecutor params = customerCreditListPageAsync.params response = customerCreditListPageAsync.response } fun service(service: CreditServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerCreditListParams) = apply { this.params = params } @@ -116,6 +116,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -125,50 +126,22 @@ private constructor( fun build(): CustomerCreditListPageAsync = CustomerCreditListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerCreditListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerCreditListResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerCreditListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerCreditListPageAsync{service=$service, params=$params, response=$response}" + "CustomerCreditListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt index 7e1662ead..e04da8ac4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.credits.TopUpService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [TopUpService.listByExternalId] */ @@ -16,7 +16,7 @@ private constructor( private val service: TopUpService, private val params: CustomerCreditTopUpListByExternalIdParams, private val response: CustomerCreditTopUpListByExternalIdPageResponse, -) { +) : Page { /** * Delegates to [CustomerCreditTopUpListByExternalIdPageResponse], but gracefully handles @@ -36,31 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditTopUpListByExternalIdParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.listByExternalId(it) } + override fun nextPage(): CustomerCreditTopUpListByExternalIdPage = + service.listByExternalId(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerCreditTopUpListByExternalIdParams = params @@ -136,26 +128,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerCreditTopUpListByExternalIdPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt index 7ea10578a..1dab7a909 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.credits.TopUpServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [TopUpServiceAsync.listByExternalId] */ class CustomerCreditTopUpListByExternalIdPageAsync private constructor( private val service: TopUpServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerCreditTopUpListByExternalIdParams, private val response: CustomerCreditTopUpListByExternalIdPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerCreditTopUpListByExternalIdPageResponse], but gracefully handles @@ -37,33 +39,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditTopUpListByExternalIdParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.listByExternalId(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.listByExternalId(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerCreditTopUpListByExternalIdParams = params @@ -82,6 +75,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -93,6 +87,7 @@ private constructor( class Builder internal constructor() { private var service: TopUpServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerCreditTopUpListByExternalIdParams? = null private var response: CustomerCreditTopUpListByExternalIdPageResponse? = null @@ -102,12 +97,18 @@ private constructor( CustomerCreditTopUpListByExternalIdPageAsync ) = apply { service = customerCreditTopUpListByExternalIdPageAsync.service + streamHandlerExecutor = + customerCreditTopUpListByExternalIdPageAsync.streamHandlerExecutor params = customerCreditTopUpListByExternalIdPageAsync.params response = customerCreditTopUpListByExternalIdPageAsync.response } fun service(service: TopUpServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerCreditTopUpListByExternalIdParams) = apply { this.params = params @@ -126,6 +127,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -135,52 +137,22 @@ private constructor( fun build(): CustomerCreditTopUpListByExternalIdPageAsync = CustomerCreditTopUpListByExternalIdPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerCreditTopUpListByExternalIdPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerCreditTopUpListByExternalIdResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList( - executor: Executor - ): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditTopUpListByExternalIdPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpListByExternalIdPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerCreditTopUpListByExternalIdPageAsync{service=$service, params=$params, response=$response}" + "CustomerCreditTopUpListByExternalIdPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt index 8b8931477..c2b5d7d35 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.customers.credits.TopUpService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [TopUpService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: TopUpService, private val params: CustomerCreditTopUpListParams, private val response: CustomerCreditTopUpListPageResponse, -) { +) : Page { /** * Delegates to [CustomerCreditTopUpListPageResponse], but gracefully handles missing data. @@ -34,31 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditTopUpListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): CustomerCreditTopUpListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerCreditTopUpListParams = params @@ -129,26 +120,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerCreditTopUpListPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt index 311e993a7..fe8e76c4b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.customers.credits.TopUpServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [TopUpServiceAsync.list] */ class CustomerCreditTopUpListPageAsync private constructor( private val service: TopUpServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerCreditTopUpListParams, private val response: CustomerCreditTopUpListPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerCreditTopUpListPageResponse], but gracefully handles missing data. @@ -35,33 +37,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerCreditTopUpListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerCreditTopUpListParams = params @@ -80,6 +73,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -91,6 +85,7 @@ private constructor( class Builder internal constructor() { private var service: TopUpServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerCreditTopUpListParams? = null private var response: CustomerCreditTopUpListPageResponse? = null @@ -98,12 +93,17 @@ private constructor( internal fun from(customerCreditTopUpListPageAsync: CustomerCreditTopUpListPageAsync) = apply { service = customerCreditTopUpListPageAsync.service + streamHandlerExecutor = customerCreditTopUpListPageAsync.streamHandlerExecutor params = customerCreditTopUpListPageAsync.params response = customerCreditTopUpListPageAsync.response } fun service(service: TopUpServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerCreditTopUpListParams) = apply { this.params = params } @@ -120,6 +120,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -129,50 +130,22 @@ private constructor( fun build(): CustomerCreditTopUpListPageAsync = CustomerCreditTopUpListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerCreditTopUpListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (CustomerCreditTopUpListResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditTopUpListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerCreditTopUpListPageAsync{service=$service, params=$params, response=$response}" + "CustomerCreditTopUpListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt index 4f51a3baa..ec69b465a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.CustomerService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [CustomerService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: CustomerService, private val params: CustomerListParams, private val response: CustomerListPageResponse, -) { +) : Page { /** * Delegates to [CustomerListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): CustomerListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): CustomerListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: CustomerListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt index 849280469..ab3143216 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.CustomerServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [CustomerServiceAsync.list] */ class CustomerListPageAsync private constructor( private val service: CustomerServiceAsync, + private val streamHandlerExecutor: Executor, private val params: CustomerListParams, private val response: CustomerListPageResponse, -) { +) : PageAsync { /** * Delegates to [CustomerListPageResponse], but gracefully handles missing data. @@ -34,33 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): CustomerListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): CustomerListParams = params @@ -78,6 +70,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +82,24 @@ private constructor( class Builder internal constructor() { private var service: CustomerServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: CustomerListParams? = null private var response: CustomerListPageResponse? = null @JvmSynthetic internal fun from(customerListPageAsync: CustomerListPageAsync) = apply { service = customerListPageAsync.service + streamHandlerExecutor = customerListPageAsync.streamHandlerExecutor params = customerListPageAsync.params response = customerListPageAsync.response } fun service(service: CustomerServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: CustomerListParams) = apply { this.params = params } @@ -115,6 +114,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +124,22 @@ private constructor( fun build(): CustomerListPageAsync = CustomerListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: CustomerListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Customer) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is CustomerListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "CustomerListPageAsync{service=$service, params=$params, response=$response}" + "CustomerListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPage.kt index 7d685ba51..899015d7e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.DimensionalPriceGroupService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [DimensionalPriceGroupService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: DimensionalPriceGroupService, private val params: DimensionalPriceGroupListParams, private val response: DimensionalPriceGroups, -) { +) : Page { /** * Delegates to [DimensionalPriceGroups], but gracefully handles missing data. @@ -34,31 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): DimensionalPriceGroupListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): DimensionalPriceGroupListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): DimensionalPriceGroupListParams = params @@ -128,26 +119,6 @@ private constructor( ) } - class AutoPager(private val firstPage: DimensionalPriceGroupListPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPageAsync.kt index a823786c9..4575dde4d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.DimensionalPriceGroupServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [DimensionalPriceGroupServiceAsync.list] */ class DimensionalPriceGroupListPageAsync private constructor( private val service: DimensionalPriceGroupServiceAsync, + private val streamHandlerExecutor: Executor, private val params: DimensionalPriceGroupListParams, private val response: DimensionalPriceGroups, -) { +) : PageAsync { /** * Delegates to [DimensionalPriceGroups], but gracefully handles missing data. @@ -35,33 +37,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): DimensionalPriceGroupListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): DimensionalPriceGroupListParams = params @@ -80,6 +73,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -91,6 +85,7 @@ private constructor( class Builder internal constructor() { private var service: DimensionalPriceGroupServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: DimensionalPriceGroupListParams? = null private var response: DimensionalPriceGroups? = null @@ -98,12 +93,17 @@ private constructor( internal fun from(dimensionalPriceGroupListPageAsync: DimensionalPriceGroupListPageAsync) = apply { service = dimensionalPriceGroupListPageAsync.service + streamHandlerExecutor = dimensionalPriceGroupListPageAsync.streamHandlerExecutor params = dimensionalPriceGroupListPageAsync.params response = dimensionalPriceGroupListPageAsync.response } fun service(service: DimensionalPriceGroupServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: DimensionalPriceGroupListParams) = apply { this.params = params } @@ -118,6 +118,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -127,50 +128,22 @@ private constructor( fun build(): DimensionalPriceGroupListPageAsync = DimensionalPriceGroupListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: DimensionalPriceGroupListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (DimensionalPriceGroup) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DimensionalPriceGroupListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is DimensionalPriceGroupListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "DimensionalPriceGroupListPageAsync{service=$service, params=$params, response=$response}" + "DimensionalPriceGroupListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPage.kt index bfcc86365..68258174e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.events.BackfillService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [BackfillService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: BackfillService, private val params: EventBackfillListParams, private val response: EventBackfillListPageResponse, -) { +) : Page { /** * Delegates to [EventBackfillListPageResponse], but gracefully handles missing data. @@ -34,31 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): EventBackfillListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.list(it) } + override fun nextPage(): EventBackfillListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): EventBackfillListParams = params @@ -127,26 +118,6 @@ private constructor( ) } - class AutoPager(private val firstPage: EventBackfillListPage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPageAsync.kt index 21a3d2533..c2175ff8d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.events.BackfillServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [BackfillServiceAsync.list] */ class EventBackfillListPageAsync private constructor( private val service: BackfillServiceAsync, + private val streamHandlerExecutor: Executor, private val params: EventBackfillListParams, private val response: EventBackfillListPageResponse, -) { +) : PageAsync { /** * Delegates to [EventBackfillListPageResponse], but gracefully handles missing data. @@ -35,33 +37,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): EventBackfillListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): EventBackfillListParams = params @@ -79,6 +72,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -90,18 +84,24 @@ private constructor( class Builder internal constructor() { private var service: BackfillServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: EventBackfillListParams? = null private var response: EventBackfillListPageResponse? = null @JvmSynthetic internal fun from(eventBackfillListPageAsync: EventBackfillListPageAsync) = apply { service = eventBackfillListPageAsync.service + streamHandlerExecutor = eventBackfillListPageAsync.streamHandlerExecutor params = eventBackfillListPageAsync.params response = eventBackfillListPageAsync.response } fun service(service: BackfillServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: EventBackfillListParams) = apply { this.params = params } @@ -116,6 +116,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -125,50 +126,22 @@ private constructor( fun build(): EventBackfillListPageAsync = EventBackfillListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: EventBackfillListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (EventBackfillListResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EventBackfillListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is EventBackfillListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "EventBackfillListPageAsync{service=$service, params=$params, response=$response}" + "EventBackfillListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPage.kt index 6584cb93d..3eb2ae02c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.InvoiceService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [InvoiceService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: InvoiceService, private val params: InvoiceListParams, private val response: InvoiceListPageResponse, -) { +) : Page { /** * Delegates to [InvoiceListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): InvoiceListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): InvoiceListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): InvoiceListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: InvoiceListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPageAsync.kt index 4ae13b3a0..495115c38 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.InvoiceServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [InvoiceServiceAsync.list] */ class InvoiceListPageAsync private constructor( private val service: InvoiceServiceAsync, + private val streamHandlerExecutor: Executor, private val params: InvoiceListParams, private val response: InvoiceListPageResponse, -) { +) : PageAsync { /** * Delegates to [InvoiceListPageResponse], but gracefully handles missing data. @@ -34,33 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): InvoiceListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): InvoiceListParams = params @@ -78,6 +70,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +82,24 @@ private constructor( class Builder internal constructor() { private var service: InvoiceServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: InvoiceListParams? = null private var response: InvoiceListPageResponse? = null @JvmSynthetic internal fun from(invoiceListPageAsync: InvoiceListPageAsync) = apply { service = invoiceListPageAsync.service + streamHandlerExecutor = invoiceListPageAsync.streamHandlerExecutor params = invoiceListPageAsync.params response = invoiceListPageAsync.response } fun service(service: InvoiceServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: InvoiceListParams) = apply { this.params = params } @@ -115,6 +114,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +124,22 @@ private constructor( fun build(): InvoiceListPageAsync = InvoiceListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: InvoiceListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Invoice) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is InvoiceListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is InvoiceListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "InvoiceListPageAsync{service=$service, params=$params, response=$response}" + "InvoiceListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPage.kt index 49f8acf10..4a7252052 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.ItemService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [ItemService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: ItemService, private val params: ItemListParams, private val response: ItemListPageResponse, -) { +) : Page { /** * Delegates to [ItemListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): ItemListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): ItemListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): ItemListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: ItemListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPageAsync.kt index fb75f340f..89d544c98 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.ItemServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [ItemServiceAsync.list] */ class ItemListPageAsync private constructor( private val service: ItemServiceAsync, + private val streamHandlerExecutor: Executor, private val params: ItemListParams, private val response: ItemListPageResponse, -) { +) : PageAsync { /** * Delegates to [ItemListPageResponse], but gracefully handles missing data. @@ -34,33 +36,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): ItemListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): ItemListParams = params @@ -78,6 +69,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +81,24 @@ private constructor( class Builder internal constructor() { private var service: ItemServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: ItemListParams? = null private var response: ItemListPageResponse? = null @JvmSynthetic internal fun from(itemListPageAsync: ItemListPageAsync) = apply { service = itemListPageAsync.service + streamHandlerExecutor = itemListPageAsync.streamHandlerExecutor params = itemListPageAsync.params response = itemListPageAsync.response } fun service(service: ItemServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: ItemListParams) = apply { this.params = params } @@ -115,6 +113,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +123,22 @@ private constructor( fun build(): ItemListPageAsync = ItemListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: ItemListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Item) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ItemListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is ItemListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "ItemListPageAsync{service=$service, params=$params, response=$response}" + "ItemListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPage.kt index bd8cb5043..5c32106c9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.MetricService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [MetricService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: MetricService, private val params: MetricListParams, private val response: MetricListPageResponse, -) { +) : Page { /** * Delegates to [MetricListPageResponse], but gracefully handles missing data. @@ -34,30 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): MetricListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): MetricListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): MetricListParams = params @@ -126,25 +118,6 @@ private constructor( ) } - class AutoPager(private val firstPage: MetricListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPageAsync.kt index 9f509035a..78d941321 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.MetricServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [MetricServiceAsync.list] */ class MetricListPageAsync private constructor( private val service: MetricServiceAsync, + private val streamHandlerExecutor: Executor, private val params: MetricListParams, private val response: MetricListPageResponse, -) { +) : PageAsync { /** * Delegates to [MetricListPageResponse], but gracefully handles missing data. @@ -35,33 +37,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): MetricListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): MetricListParams = params @@ -79,6 +71,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -90,18 +83,24 @@ private constructor( class Builder internal constructor() { private var service: MetricServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: MetricListParams? = null private var response: MetricListPageResponse? = null @JvmSynthetic internal fun from(metricListPageAsync: MetricListPageAsync) = apply { service = metricListPageAsync.service + streamHandlerExecutor = metricListPageAsync.streamHandlerExecutor params = metricListPageAsync.params response = metricListPageAsync.response } fun service(service: MetricServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: MetricListParams) = apply { this.params = params } @@ -116,6 +115,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -125,50 +125,22 @@ private constructor( fun build(): MetricListPageAsync = MetricListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: MetricListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (BillableMetric) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is MetricListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is MetricListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "MetricListPageAsync{service=$service, params=$params, response=$response}" + "MetricListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPage.kt index 3442a4638..c2506318a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.PlanService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [PlanService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: PlanService, private val params: PlanListParams, private val response: PlanListPageResponse, -) { +) : Page { /** * Delegates to [PlanListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): PlanListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): PlanListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): PlanListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: PlanListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPageAsync.kt index f12c610fe..7cb079f9b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.PlanServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [PlanServiceAsync.list] */ class PlanListPageAsync private constructor( private val service: PlanServiceAsync, + private val streamHandlerExecutor: Executor, private val params: PlanListParams, private val response: PlanListPageResponse, -) { +) : PageAsync { /** * Delegates to [PlanListPageResponse], but gracefully handles missing data. @@ -34,33 +36,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): PlanListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): PlanListParams = params @@ -78,6 +69,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +81,24 @@ private constructor( class Builder internal constructor() { private var service: PlanServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: PlanListParams? = null private var response: PlanListPageResponse? = null @JvmSynthetic internal fun from(planListPageAsync: PlanListPageAsync) = apply { service = planListPageAsync.service + streamHandlerExecutor = planListPageAsync.streamHandlerExecutor params = planListPageAsync.params response = planListPageAsync.response } fun service(service: PlanServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: PlanListParams) = apply { this.params = params } @@ -115,6 +113,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +123,22 @@ private constructor( fun build(): PlanListPageAsync = PlanListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: PlanListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Plan) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PlanListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is PlanListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "PlanListPageAsync{service=$service, params=$params, response=$response}" + "PlanListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPage.kt index 90ac2e313..852625a93 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.PriceService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [PriceService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: PriceService, private val params: PriceListParams, private val response: PriceListPageResponse, -) { +) : Page { /** * Delegates to [PriceListPageResponse], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): PriceListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): PriceListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): PriceListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: PriceListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageAsync.kt index e38c33a45..7d5b880e1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.PriceServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [PriceServiceAsync.list] */ class PriceListPageAsync private constructor( private val service: PriceServiceAsync, + private val streamHandlerExecutor: Executor, private val params: PriceListParams, private val response: PriceListPageResponse, -) { +) : PageAsync { /** * Delegates to [PriceListPageResponse], but gracefully handles missing data. @@ -34,33 +36,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): PriceListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): PriceListParams = params @@ -78,6 +69,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +81,24 @@ private constructor( class Builder internal constructor() { private var service: PriceServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: PriceListParams? = null private var response: PriceListPageResponse? = null @JvmSynthetic internal fun from(priceListPageAsync: PriceListPageAsync) = apply { service = priceListPageAsync.service + streamHandlerExecutor = priceListPageAsync.streamHandlerExecutor params = priceListPageAsync.params response = priceListPageAsync.response } fun service(service: PriceServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: PriceListParams) = apply { this.params = params } @@ -115,6 +113,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +123,22 @@ private constructor( fun build(): PriceListPageAsync = PriceListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: PriceListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Price) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PriceListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is PriceListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "PriceListPageAsync{service=$service, params=$params, response=$response}" + "PriceListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePage.kt index 2e815413a..c82630725 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.SubscriptionService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [SubscriptionService.fetchSchedule] */ @@ -16,7 +16,7 @@ private constructor( private val service: SubscriptionService, private val params: SubscriptionFetchScheduleParams, private val response: SubscriptionFetchSchedulePageResponse, -) { +) : Page { /** * Delegates to [SubscriptionFetchSchedulePageResponse], but gracefully handles missing data. @@ -34,31 +34,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): SubscriptionFetchScheduleParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = - getNextPageParams().map { service.fetchSchedule(it) } + override fun nextPage(): SubscriptionFetchSchedulePage = service.fetchSchedule(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): SubscriptionFetchScheduleParams = params @@ -130,26 +121,6 @@ private constructor( ) } - class AutoPager(private val firstPage: SubscriptionFetchSchedulePage) : - Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePageAsync.kt index b98954526..524dd761d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchSchedulePageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.SubscriptionServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [SubscriptionServiceAsync.fetchSchedule] */ class SubscriptionFetchSchedulePageAsync private constructor( private val service: SubscriptionServiceAsync, + private val streamHandlerExecutor: Executor, private val params: SubscriptionFetchScheduleParams, private val response: SubscriptionFetchSchedulePageResponse, -) { +) : PageAsync { /** * Delegates to [SubscriptionFetchSchedulePageResponse], but gracefully handles missing data. @@ -35,33 +37,24 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): SubscriptionFetchScheduleParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.fetchSchedule(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.fetchSchedule(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = + AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): SubscriptionFetchScheduleParams = params @@ -80,6 +73,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -91,6 +85,7 @@ private constructor( class Builder internal constructor() { private var service: SubscriptionServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: SubscriptionFetchScheduleParams? = null private var response: SubscriptionFetchSchedulePageResponse? = null @@ -98,12 +93,17 @@ private constructor( internal fun from(subscriptionFetchSchedulePageAsync: SubscriptionFetchSchedulePageAsync) = apply { service = subscriptionFetchSchedulePageAsync.service + streamHandlerExecutor = subscriptionFetchSchedulePageAsync.streamHandlerExecutor params = subscriptionFetchSchedulePageAsync.params response = subscriptionFetchSchedulePageAsync.response } fun service(service: SubscriptionServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: SubscriptionFetchScheduleParams) = apply { this.params = params } @@ -120,6 +120,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -129,50 +130,22 @@ private constructor( fun build(): SubscriptionFetchSchedulePageAsync = SubscriptionFetchSchedulePageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: SubscriptionFetchSchedulePageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (SubscriptionFetchScheduleResponse) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionFetchSchedulePageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is SubscriptionFetchSchedulePageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "SubscriptionFetchSchedulePageAsync{service=$service, params=$params, response=$response}" + "SubscriptionFetchSchedulePageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPage.kt index 6dbe30e25..bcef627ce 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPage.kt @@ -2,12 +2,12 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPager +import com.withorb.api.core.Page import com.withorb.api.core.checkRequired import com.withorb.api.services.blocking.SubscriptionService import java.util.Objects import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull /** @see [SubscriptionService.list] */ @@ -16,7 +16,7 @@ private constructor( private val service: SubscriptionService, private val params: SubscriptionListParams, private val response: Subscriptions, -) { +) : Page { /** * Delegates to [Subscriptions], but gracefully handles missing data. @@ -33,30 +33,22 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): SubscriptionListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } + override fun nextPage(): SubscriptionListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): SubscriptionListParams = params @@ -125,25 +117,6 @@ private constructor( ) } - class AutoPager(private val firstPage: SubscriptionListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage().getOrNull() ?: break - index = 0 - } - } - - fun stream(): Stream { - return StreamSupport.stream(spliterator(), false) - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPageAsync.kt index 455951073..394c5cb78 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPageAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListPageAsync.kt @@ -2,22 +2,24 @@ package com.withorb.api.models +import com.withorb.api.core.AutoPagerAsync +import com.withorb.api.core.PageAsync import com.withorb.api.core.checkRequired import com.withorb.api.services.async.SubscriptionServiceAsync import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor -import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull /** @see [SubscriptionServiceAsync.list] */ class SubscriptionListPageAsync private constructor( private val service: SubscriptionServiceAsync, + private val streamHandlerExecutor: Executor, private val params: SubscriptionListParams, private val response: Subscriptions, -) { +) : PageAsync { /** * Delegates to [Subscriptions], but gracefully handles missing data. @@ -34,33 +36,23 @@ private constructor( fun paginationMetadata(): Optional = response._paginationMetadata().getOptional("pagination_metadata") - fun hasNextPage(): Boolean = - data().isNotEmpty() && - paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent + override fun items(): List = data() - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } + override fun hasNextPage(): Boolean = + items().isNotEmpty() && + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.isPresent - return Optional.of( - params - .toBuilder() - .apply { - paginationMetadata() - .flatMap { it._nextCursor().getOptional("next_cursor") } - .ifPresent { cursor(it) } - } - .build() - ) + fun nextPageParams(): SubscriptionListParams { + val nextCursor = + paginationMetadata().flatMap { it._nextCursor().getOptional("next_cursor") }.getOrNull() + ?: throw IllegalStateException("Cannot construct next page params") + return params.toBuilder().cursor(nextCursor).build() } - fun getNextPage(): CompletableFuture> = - getNextPageParams() - .map { service.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager(this) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): SubscriptionListParams = params @@ -78,6 +70,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -89,18 +82,24 @@ private constructor( class Builder internal constructor() { private var service: SubscriptionServiceAsync? = null + private var streamHandlerExecutor: Executor? = null private var params: SubscriptionListParams? = null private var response: Subscriptions? = null @JvmSynthetic internal fun from(subscriptionListPageAsync: SubscriptionListPageAsync) = apply { service = subscriptionListPageAsync.service + streamHandlerExecutor = subscriptionListPageAsync.streamHandlerExecutor params = subscriptionListPageAsync.params response = subscriptionListPageAsync.response } fun service(service: SubscriptionServiceAsync) = apply { this.service = service } + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + /** The parameters that were used to request this page. */ fun params(params: SubscriptionListParams) = apply { this.params = params } @@ -115,6 +114,7 @@ private constructor( * The following fields are required: * ```java * .service() + * .streamHandlerExecutor() * .params() * .response() * ``` @@ -124,47 +124,22 @@ private constructor( fun build(): SubscriptionListPageAsync = SubscriptionListPageAsync( checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), checkRequired("params", params), checkRequired("response", response), ) } - class AutoPager(private val firstPage: SubscriptionListPageAsync) { - - fun forEach(action: Predicate, executor: Executor): CompletableFuture { - fun CompletableFuture>.forEach( - action: (Subscription) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().all(action) } - .map { it.getNextPage().forEach(action, executor) } - .orElseGet { CompletableFuture.completedFuture(null) } - }, - executor, - ) - return CompletableFuture.completedFuture(Optional.of(firstPage)) - .forEach(action::test, executor) - } - - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() - return forEach(values::add, executor).thenApply { values } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + return /* spotless:off */ other is SubscriptionListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */ override fun toString() = - "SubscriptionListPageAsync{service=$service, params=$params, response=$response}" + "SubscriptionListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt index 3dcd55db0..b54ccfc78 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt @@ -194,6 +194,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie .let { AlertListPageAsync.builder() .service(AlertServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt index 78f476779..e9232e599 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt @@ -141,6 +141,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli .let { CouponListPageAsync.builder() .service(CouponServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt index 3320325d4..c72611982 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt @@ -119,6 +119,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: .let { CreditNoteListPageAsync.builder() .service(CreditNoteServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt index 23e5bcd8b..203abbad2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt @@ -244,6 +244,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C .let { CustomerListPageAsync.builder() .service(CustomerServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt index 1e5a44e0a..8588a90b5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt @@ -173,6 +173,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric .let { DimensionalPriceGroupListPageAsync.builder() .service(DimensionalPriceGroupServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt index 2a7720037..4470c68a1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt @@ -201,6 +201,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl .let { InvoiceListPageAsync.builder() .service(InvoiceServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt index e814229dd..c96f026f1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt @@ -160,6 +160,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien .let { ItemListPageAsync.builder() .service(ItemServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt index f7e1aa1b3..9c2a533bb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt @@ -160,6 +160,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli .let { MetricListPageAsync.builder() .service(MetricServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt index 535998006..5a2dc2372 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt @@ -174,6 +174,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien .let { PlanListPageAsync.builder() .service(PlanServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt index 8f9bbc360..af00ee2e9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt @@ -184,6 +184,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie .let { PriceListPageAsync.builder() .service(PriceServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt index 4585b4d8e..4911183c9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt @@ -274,6 +274,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption .let { SubscriptionListPageAsync.builder() .service(SubscriptionServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() @@ -413,6 +414,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption .let { SubscriptionFetchSchedulePageAsync.builder() .service(SubscriptionServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt index e28fbc6ce..0374a8521 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncImpl.kt @@ -73,6 +73,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption .let { CouponSubscriptionListPageAsync.builder() .service(SubscriptionServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt index 79c1e7524..817135f9b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncImpl.kt @@ -118,6 +118,7 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact .let { CustomerBalanceTransactionListPageAsync.builder() .service(BalanceTransactionServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt index 9ac2482ae..2e201b33e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncImpl.kt @@ -108,6 +108,7 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli .let { CustomerCreditListPageAsync.builder() .service(CreditServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() @@ -153,6 +154,7 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli .let { CustomerCreditListByExternalIdPageAsync.builder() .service(CreditServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt index eb3adce31..f168ea413 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncImpl.kt @@ -103,6 +103,7 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli .let { CustomerCreditLedgerListPageAsync.builder() .service(LedgerServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() @@ -227,6 +228,7 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli .let { CustomerCreditLedgerListByExternalIdPageAsync.builder() .service(LedgerServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt index f197f7793..b8c3b4fbe 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt @@ -155,6 +155,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie .let { CustomerCreditTopUpListPageAsync.builder() .service(TopUpServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() @@ -305,6 +306,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie .let { CustomerCreditTopUpListByExternalIdPageAsync.builder() .service(TopUpServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt index 510741db9..81912befb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncImpl.kt @@ -139,6 +139,7 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C .let { EventBackfillListPageAsync.builder() .service(BackfillServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) .params(params) .response(it) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerAsyncTest.kt new file mode 100644 index 000000000..625a47af1 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerAsyncTest.kt @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +import com.withorb.api.core.http.AsyncStreamResponse +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.catchThrowable +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.kotlin.any +import org.mockito.kotlin.clearInvocations +import org.mockito.kotlin.doAnswer +import org.mockito.kotlin.inOrder +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.spy +import org.mockito.kotlin.times +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +@ExtendWith(MockitoExtension::class) +internal class AutoPagerAsyncTest { + + companion object { + + private val ERROR = RuntimeException("ERROR!") + } + + private class PageAsyncImpl( + private val items: List, + private val hasNext: Boolean = true, + ) : PageAsync { + + val nextPageFuture: CompletableFuture> = CompletableFuture() + + override fun hasNextPage(): Boolean = hasNext + + override fun nextPage(): CompletableFuture> = nextPageFuture + + override fun items(): List = items + } + + private val executor = + spy { + doAnswer { invocation -> invocation.getArgument(0).run() } + .whenever(it) + .execute(any()) + } + private val handler = mock>() + + @Test + fun subscribe_whenAlreadySubscribed_throws() { + val autoPagerAsync = AutoPagerAsync.from(PageAsyncImpl(emptyList()), executor) + autoPagerAsync.subscribe {} + clearInvocations(executor) + + val throwable = catchThrowable { autoPagerAsync.subscribe {} } + + assertThat(throwable).isInstanceOf(IllegalStateException::class.java) + assertThat(throwable).hasMessage("Cannot subscribe more than once") + verify(executor, never()).execute(any()) + } + + @Test + fun subscribe_whenClosed_throws() { + val autoPagerAsync = AutoPagerAsync.from(PageAsyncImpl(emptyList()), executor) + autoPagerAsync.close() + + val throwable = catchThrowable { autoPagerAsync.subscribe {} } + + assertThat(throwable).isInstanceOf(IllegalStateException::class.java) + assertThat(throwable).hasMessage("Cannot subscribe after the response is closed") + verify(executor, never()).execute(any()) + } + + @Test + fun subscribe_whenFirstPageNonEmpty_runsHandler() { + val page = PageAsyncImpl(listOf("item1", "item2", "item3"), hasNext = false) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + + autoPagerAsync.subscribe(handler) + + inOrder(executor, handler) { + verify(executor, times(1)).execute(any()) + verify(handler, times(1)).onNext("item1") + verify(handler, times(1)).onNext("item2") + verify(handler, times(1)).onNext("item3") + verify(handler, times(1)).onComplete(Optional.empty()) + } + } + + @Test + fun subscribe_whenFutureCompletesAfterClose_doesNothing() { + val page = PageAsyncImpl(listOf("page1")) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + autoPagerAsync.subscribe(handler) + autoPagerAsync.close() + + page.nextPageFuture.complete(PageAsyncImpl(listOf("page2"))) + + verify(handler, times(1)).onNext("page1") + verify(handler, never()).onNext("page2") + verify(handler, times(1)).onComplete(Optional.empty()) + verify(executor, times(1)).execute(any()) + } + + @Test + fun subscribe_whenFutureErrors_callsOnComplete() { + val page = PageAsyncImpl(emptyList()) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + autoPagerAsync.subscribe(handler) + + page.nextPageFuture.completeExceptionally(ERROR) + + verify(executor, times(1)).execute(any()) + verify(handler, never()).onNext(any()) + verify(handler, times(1)).onComplete(Optional.of(ERROR)) + } + + @Test + fun subscribe_whenFutureCompletes_runsHandler() { + val page = PageAsyncImpl(listOf("chunk1", "chunk2")) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + + autoPagerAsync.subscribe(handler) + + verify(handler, never()).onComplete(any()) + inOrder(executor, handler) { + verify(executor, times(1)).execute(any()) + verify(handler, times(1)).onNext("chunk1") + verify(handler, times(1)).onNext("chunk2") + } + clearInvocations(executor, handler) + + page.nextPageFuture.complete(PageAsyncImpl(listOf("chunk3", "chunk4"), hasNext = false)) + + verify(executor, never()).execute(any()) + inOrder(handler) { + verify(handler, times(1)).onNext("chunk3") + verify(handler, times(1)).onNext("chunk4") + verify(handler, times(1)).onComplete(Optional.empty()) + } + } + + @Test + fun onCompleteFuture_whenNextPageFutureNotCompleted_onCompleteFutureNotCompleted() { + val page = PageAsyncImpl(listOf("chunk1", "chunk2")) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + autoPagerAsync.subscribe {} + + val onCompletableFuture = autoPagerAsync.onCompleteFuture() + + assertThat(onCompletableFuture).isNotCompleted + } + + @Test + fun onCompleteFuture_whenNextPageFutureErrors_onCompleteFutureCompletedExceptionally() { + val page = PageAsyncImpl(listOf("chunk1", "chunk2")) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + autoPagerAsync.subscribe {} + page.nextPageFuture.completeExceptionally(ERROR) + + val onCompletableFuture = autoPagerAsync.onCompleteFuture() + + assertThat(onCompletableFuture).isCompletedExceptionally + } + + @Test + fun onCompleteFuture_whenNoNextPage_onCompleteFutureCompleted() { + val page = PageAsyncImpl(listOf("chunk1", "chunk2"), hasNext = false) + val autoPagerAsync = AutoPagerAsync.from(page, executor) + autoPagerAsync.subscribe {} + + val onCompletableFuture = autoPagerAsync.onCompleteFuture() + + assertThat(onCompletableFuture).isCompleted + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerTest.kt new file mode 100644 index 000000000..1ba0c0060 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/AutoPagerTest.kt @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class AutoPagerTest { + + private class PageImpl( + private val items: List, + private val nextPage: Page? = null, + ) : Page { + + override fun hasNextPage(): Boolean = nextPage != null + + override fun nextPage(): Page = nextPage!! + + override fun items(): List = items + } + + @Test + fun iterator() { + val firstPage = + PageImpl(listOf("chunk1", "chunk2"), nextPage = PageImpl(listOf("chunk3", "chunk4"))) + + val autoPager = AutoPager.from(firstPage) + + assertThat(autoPager).containsExactly("chunk1", "chunk2", "chunk3", "chunk4") + } + + @Test + fun stream() { + val firstPage = + PageImpl(listOf("chunk1", "chunk2"), nextPage = PageImpl(listOf("chunk3", "chunk4"))) + + val autoPager = AutoPager.from(firstPage) + + assertThat(autoPager.stream()).containsExactly("chunk1", "chunk2", "chunk3", "chunk4") + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/AsyncStreamResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/AsyncStreamResponseTest.kt new file mode 100644 index 000000000..3fc59d9db --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/AsyncStreamResponseTest.kt @@ -0,0 +1,268 @@ +package com.withorb.api.core.http + +import java.util.* +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor +import java.util.stream.Stream +import kotlin.streams.asStream +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.catchThrowable +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertDoesNotThrow +import org.junit.jupiter.api.extension.ExtendWith +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.kotlin.* + +@ExtendWith(MockitoExtension::class) +internal class AsyncStreamResponseTest { + + companion object { + private val ERROR = RuntimeException("ERROR!") + } + + private val streamResponse = + spy> { + doReturn(Stream.of("chunk1", "chunk2", "chunk3")).whenever(it).stream() + } + private val erroringStreamResponse = + spy> { + doReturn( + sequence { + yield("chunk1") + yield("chunk2") + throw ERROR + } + .asStream() + ) + .whenever(it) + .stream() + } + private val executor = + spy { + doAnswer { invocation -> invocation.getArgument(0).run() } + .whenever(it) + .execute(any()) + } + private val handler = mock>() + + @Test + fun subscribe_whenAlreadySubscribed_throws() { + val asyncStreamResponse = CompletableFuture>().toAsync(executor) + asyncStreamResponse.subscribe {} + + val throwable = catchThrowable { asyncStreamResponse.subscribe {} } + + assertThat(throwable).isInstanceOf(IllegalStateException::class.java) + assertThat(throwable).hasMessage("Cannot subscribe more than once") + verify(executor, never()).execute(any()) + } + + @Test + fun subscribe_whenClosed_throws() { + val asyncStreamResponse = CompletableFuture>().toAsync(executor) + asyncStreamResponse.close() + + val throwable = catchThrowable { asyncStreamResponse.subscribe {} } + + assertThat(throwable).isInstanceOf(IllegalStateException::class.java) + assertThat(throwable).hasMessage("Cannot subscribe after the response is closed") + verify(executor, never()).execute(any()) + } + + @Test + fun subscribe_whenFutureCompletesAfterClose_doesNothing() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe(handler) + asyncStreamResponse.close() + + future.complete(streamResponse) + + verify(handler, never()).onNext(any()) + verify(handler, never()).onComplete(any()) + verify(executor, times(1)).execute(any()) + } + + @Test + fun subscribe_whenFutureErrors_callsOnComplete() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe(handler) + + future.completeExceptionally(ERROR) + + verify(handler, never()).onNext(any()) + verify(handler, times(1)).onComplete(Optional.of(ERROR)) + verify(executor, times(1)).execute(any()) + } + + @Test + fun subscribe_whenFutureCompletes_runsHandler() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe(handler) + + future.complete(streamResponse) + + inOrder(handler, streamResponse) { + verify(handler, times(1)).onNext("chunk1") + verify(handler, times(1)).onNext("chunk2") + verify(handler, times(1)).onNext("chunk3") + verify(handler, times(1)).onComplete(Optional.empty()) + verify(streamResponse, times(1)).close() + } + verify(executor, times(1)).execute(any()) + } + + @Test + fun subscribe_whenStreamErrors_callsOnCompleteEarly() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe(handler) + + future.complete(erroringStreamResponse) + + inOrder(handler, erroringStreamResponse) { + verify(handler, times(1)).onNext("chunk1") + verify(handler, times(1)).onNext("chunk2") + verify(handler, times(1)).onComplete(Optional.of(ERROR)) + verify(erroringStreamResponse, times(1)).close() + } + verify(executor, times(1)).execute(any()) + } + + @Test + fun onCompleteFuture_whenStreamResponseFutureNotCompleted_onCompleteFutureNotCompleted() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isNotCompleted + } + + @Test + fun onCompleteFuture_whenStreamResponseFutureErrors_onCompleteFutureCompletedExceptionally() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + future.completeExceptionally(ERROR) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isCompletedExceptionally + } + + @Test + fun onCompleteFuture_whenStreamResponseFutureCompletedButStillStreaming_onCompleteFutureNotCompleted() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + future.complete(streamResponse) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isNotCompleted + } + + @Test + fun onCompleteFuture_whenStreamResponseFutureCompletedAndStreamErrors_onCompleteFutureCompletedExceptionally() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe(handler) + future.complete(erroringStreamResponse) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isCompletedExceptionally + } + + @Test + fun onCompleteFuture_whenStreamResponseFutureCompletedAndStreamCompleted_onCompleteFutureCompleted() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe(handler) + future.complete(streamResponse) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isCompleted + } + + @Test + fun onCompleteFuture_whenHandlerOnCompleteWithoutThrowableThrows_onCompleteFutureCompleted() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe( + object : AsyncStreamResponse.Handler { + override fun onNext(value: String) {} + + override fun onComplete(error: Optional) = throw ERROR + } + ) + future.complete(streamResponse) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isCompleted + } + + @Test + fun onCompleteFuture_whenHandlerOnCompleteWithThrowableThrows_onCompleteFutureCompletedExceptionally() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.subscribe( + object : AsyncStreamResponse.Handler { + override fun onNext(value: String) {} + + override fun onComplete(error: Optional) = throw ERROR + } + ) + future.complete(erroringStreamResponse) + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isCompletedExceptionally + } + + @Test + fun onCompleteFuture_whenClosed_onCompleteFutureCompleted() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.close() + + val onCompletableFuture = asyncStreamResponse.onCompleteFuture() + + assertThat(onCompletableFuture).isCompleted + } + + @Test + fun close_whenNotClosed_closesStreamResponse() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + + asyncStreamResponse.close() + future.complete(streamResponse) + + verify(streamResponse, times(1)).close() + } + + @Test + fun close_whenAlreadyClosed_doesNothing() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.close() + future.complete(streamResponse) + + asyncStreamResponse.close() + + verify(streamResponse, times(1)).close() + } + + @Test + fun close_whenFutureErrors_doesNothing() { + val future = CompletableFuture>() + val asyncStreamResponse = future.toAsync(executor) + asyncStreamResponse.close() + + assertDoesNotThrow { future.completeExceptionally(ERROR) } + } +} From 9460c523ec5235f4b8b6335336be8e3b82b8527f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 00:11:41 +0000 Subject: [PATCH 14/18] refactor(client)!: improve some class names --- .../withorb/api/models/CouponCreateParams.kt | 195 +- .../CustomerCostListByExternalIdResponse.kt | 62 +- .../api/models/CustomerCostListResponse.kt | 62 +- .../api/models/CustomerCreateParams.kt | 187 +- ...editLedgerCreateEntryByExternalIdParams.kt | 625 +- ...itLedgerCreateEntryByExternalIdResponse.kt | 660 +- .../CustomerCreditLedgerCreateEntryParams.kt | 625 +- ...CustomerCreditLedgerCreateEntryResponse.kt | 663 +- ...reditLedgerListByExternalIdPageResponse.kt | 73 +- ...merCreditLedgerListByExternalIdResponse.kt | 670 +- .../CustomerCreditLedgerListPageResponse.kt | 65 +- .../CustomerCreditLedgerListResponse.kt | 649 +- .../CustomerUpdateByExternalIdParams.kt | 187 +- .../api/models/CustomerUpdateParams.kt | 187 +- .../kotlin/com/withorb/api/models/Invoice.kt | 718 +- .../models/InvoiceFetchUpcomingResponse.kt | 718 +- .../models/InvoiceLineItemCreateResponse.kt | 700 +- .../kotlin/com/withorb/api/models/Plan.kt | 534 +- .../withorb/api/models/PlanCreateParams.kt | 2925 +++---- .../kotlin/com/withorb/api/models/Price.kt | 2561 +++--- .../withorb/api/models/PriceCreateParams.kt | 3433 ++++---- .../api/models/PriceListPageResponse.kt | 58 +- .../com/withorb/api/models/Subscription.kt | 724 +- .../api/models/SubscriptionCancelResponse.kt | 724 +- .../models/SubscriptionChangeApplyResponse.kt | 759 +- .../SubscriptionChangeCancelResponse.kt | 759 +- .../SubscriptionChangeRetrieveResponse.kt | 759 +- .../api/models/SubscriptionCreateParams.kt | 7350 +++++++---------- .../api/models/SubscriptionCreateResponse.kt | 724 +- .../models/SubscriptionFetchCostsResponse.kt | 62 +- .../SubscriptionPriceIntervalsParams.kt | 3982 ++++----- .../SubscriptionPriceIntervalsResponse.kt | 724 +- .../SubscriptionSchedulePlanChangeParams.kt | 7350 +++++++---------- .../SubscriptionSchedulePlanChangeResponse.kt | 724 +- .../SubscriptionTriggerPhaseResponse.kt | 724 +- ...scriptionUnscheduleCancellationResponse.kt | 724 +- ...scheduleFixedFeeQuantityUpdatesResponse.kt | 724 +- ...ionUnschedulePendingPlanChangesResponse.kt | 724 +- ...scriptionUpdateFixedFeeQuantityResponse.kt | 724 +- .../models/SubscriptionUpdateTrialResponse.kt | 724 +- .../api/models/CouponCreateParamsTest.kt | 21 +- ...ustomerCostListByExternalIdResponseTest.kt | 104 +- .../models/CustomerCostListResponseTest.kt | 104 +- .../api/models/CustomerCreateParamsTest.kt | 8 +- ...LedgerCreateEntryByExternalIdParamsTest.kt | 97 +- ...dgerCreateEntryByExternalIdResponseTest.kt | 476 +- ...stomerCreditLedgerCreateEntryParamsTest.kt | 99 +- ...omerCreditLedgerCreateEntryResponseTest.kt | 387 +- ...tLedgerListByExternalIdPageResponseTest.kt | 44 +- ...reditLedgerListByExternalIdResponseTest.kt | 420 +- ...ustomerCreditLedgerListPageResponseTest.kt | 38 +- .../CustomerCreditLedgerListResponseTest.kt | 363 +- .../CustomerUpdateByExternalIdParamsTest.kt | 11 +- .../api/models/CustomerUpdateParamsTest.kt | 8 +- .../InvoiceFetchUpcomingResponseTest.kt | 136 +- .../InvoiceLineItemCreateResponseTest.kt | 131 +- .../api/models/InvoiceListPageResponseTest.kt | 137 +- .../com/withorb/api/models/InvoiceTest.kt | 127 +- .../api/models/PlanCreateParamsTest.kt | 75 +- .../api/models/PlanListPageResponseTest.kt | 104 +- .../kotlin/com/withorb/api/models/PlanTest.kt | 104 +- .../api/models/PriceCreateParamsTest.kt | 78 +- .../api/models/PriceListPageResponseTest.kt | 96 +- .../com/withorb/api/models/PriceTest.kt | 1956 ++--- .../models/SubscriptionCancelResponseTest.kt | 491 +- .../SubscriptionChangeApplyResponseTest.kt | 517 +- .../SubscriptionChangeCancelResponseTest.kt | 517 +- .../SubscriptionChangeRetrieveResponseTest.kt | 517 +- .../models/SubscriptionCreateParamsTest.kt | 165 +- .../models/SubscriptionCreateResponseTest.kt | 491 +- .../SubscriptionFetchCostsResponseTest.kt | 104 +- .../SubscriptionPriceIntervalsParamsTest.kt | 89 +- .../SubscriptionPriceIntervalsResponseTest.kt | 491 +- ...ubscriptionSchedulePlanChangeParamsTest.kt | 167 +- ...scriptionSchedulePlanChangeResponseTest.kt | 491 +- .../withorb/api/models/SubscriptionTest.kt | 219 +- .../SubscriptionTriggerPhaseResponseTest.kt | 492 +- ...ptionUnscheduleCancellationResponseTest.kt | 494 +- ...duleFixedFeeQuantityUpdatesResponseTest.kt | 491 +- ...nschedulePendingPlanChangesResponseTest.kt | 491 +- ...ptionUpdateFixedFeeQuantityResponseTest.kt | 494 +- .../SubscriptionUpdateTrialResponseTest.kt | 492 +- .../withorb/api/models/SubscriptionsTest.kt | 230 +- .../withorb/api/services/ErrorHandlingTest.kt | 27 +- .../withorb/api/services/ServiceParamsTest.kt | 2 +- .../services/async/CouponServiceAsyncTest.kt | 2 +- .../async/CustomerServiceAsyncTest.kt | 7 +- .../services/async/PlanServiceAsyncTest.kt | 20 +- .../services/async/PriceServiceAsyncTest.kt | 22 +- .../async/SubscriptionServiceAsyncTest.kt | 140 +- .../credits/LedgerServiceAsyncTest.kt | 22 +- .../services/blocking/CouponServiceTest.kt | 2 +- .../services/blocking/CustomerServiceTest.kt | 7 +- .../api/services/blocking/PlanServiceTest.kt | 20 +- .../api/services/blocking/PriceServiceTest.kt | 22 +- .../blocking/SubscriptionServiceTest.kt | 140 +- .../customers/credits/LedgerServiceTest.kt | 22 +- 97 files changed, 24467 insertions(+), 34097 deletions(-) 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 87db2d797..2c7b8bf39 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 @@ -161,41 +161,33 @@ private constructor( */ fun discount(discount: JsonField) = apply { body.discount(discount) } - /** - * Alias for calling [discount] with `Discount.ofNewCouponPercentage(newCouponPercentage)`. - */ - fun discount(newCouponPercentage: Discount.NewCouponPercentageDiscount) = apply { - body.discount(newCouponPercentage) - } + /** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */ + fun discount(percentage: Discount.Percentage) = apply { body.discount(percentage) } /** * Alias for calling [discount] with the following: * ```java - * Discount.NewCouponPercentageDiscount.builder() + * Discount.Percentage.builder() * .percentageDiscount(percentageDiscount) * .build() * ``` */ - fun newCouponPercentageDiscount(percentageDiscount: Double) = apply { - body.newCouponPercentageDiscount(percentageDiscount) + fun percentageDiscount(percentageDiscount: Double) = apply { + body.percentageDiscount(percentageDiscount) } - /** Alias for calling [discount] with `Discount.ofNewCouponAmount(newCouponAmount)`. */ - fun discount(newCouponAmount: Discount.NewCouponAmountDiscount) = apply { - body.discount(newCouponAmount) - } + /** Alias for calling [discount] with `Discount.ofAmount(amount)`. */ + fun discount(amount: Discount.Amount) = apply { body.discount(amount) } /** * Alias for calling [discount] with the following: * ```java - * Discount.NewCouponAmountDiscount.builder() + * Discount.Amount.builder() * .amountDiscount(amountDiscount) * .build() * ``` */ - fun newCouponAmountDiscount(amountDiscount: String) = apply { - body.newCouponAmountDiscount(amountDiscount) - } + fun amountDiscount(amountDiscount: String) = apply { body.amountDiscount(amountDiscount) } /** This string can be used to redeem this coupon for a given subscription. */ fun redemptionCode(redemptionCode: String) = apply { body.redemptionCode(redemptionCode) } @@ -562,46 +554,36 @@ private constructor( */ fun discount(discount: JsonField) = apply { this.discount = discount } - /** - * Alias for calling [discount] with - * `Discount.ofNewCouponPercentage(newCouponPercentage)`. - */ - fun discount(newCouponPercentage: Discount.NewCouponPercentageDiscount) = - discount(Discount.ofNewCouponPercentage(newCouponPercentage)) + /** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */ + fun discount(percentage: Discount.Percentage) = + discount(Discount.ofPercentage(percentage)) /** * Alias for calling [discount] with the following: * ```java - * Discount.NewCouponPercentageDiscount.builder() + * Discount.Percentage.builder() * .percentageDiscount(percentageDiscount) * .build() * ``` */ - fun newCouponPercentageDiscount(percentageDiscount: Double) = + fun percentageDiscount(percentageDiscount: Double) = discount( - Discount.NewCouponPercentageDiscount.builder() - .percentageDiscount(percentageDiscount) - .build() + Discount.Percentage.builder().percentageDiscount(percentageDiscount).build() ) - /** Alias for calling [discount] with `Discount.ofNewCouponAmount(newCouponAmount)`. */ - fun discount(newCouponAmount: Discount.NewCouponAmountDiscount) = - discount(Discount.ofNewCouponAmount(newCouponAmount)) + /** Alias for calling [discount] with `Discount.ofAmount(amount)`. */ + fun discount(amount: Discount.Amount) = discount(Discount.ofAmount(amount)) /** * Alias for calling [discount] with the following: * ```java - * Discount.NewCouponAmountDiscount.builder() + * Discount.Amount.builder() * .amountDiscount(amountDiscount) * .build() * ``` */ - fun newCouponAmountDiscount(amountDiscount: String) = - discount( - Discount.NewCouponAmountDiscount.builder() - .amountDiscount(amountDiscount) - .build() - ) + fun amountDiscount(amountDiscount: String) = + discount(Discount.Amount.builder().amountDiscount(amountDiscount).build()) /** This string can be used to redeem this coupon for a given subscription. */ fun redemptionCode(redemptionCode: String) = @@ -778,33 +760,29 @@ private constructor( @JsonSerialize(using = Discount.Serializer::class) class Discount private constructor( - private val newCouponPercentage: NewCouponPercentageDiscount? = null, - private val newCouponAmount: NewCouponAmountDiscount? = null, + private val percentage: Percentage? = null, + private val amount: Amount? = null, private val _json: JsonValue? = null, ) { - fun newCouponPercentage(): Optional = - Optional.ofNullable(newCouponPercentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun newCouponAmount(): Optional = - Optional.ofNullable(newCouponAmount) + fun amount(): Optional = Optional.ofNullable(amount) - fun isNewCouponPercentage(): Boolean = newCouponPercentage != null + fun isPercentage(): Boolean = percentage != null - fun isNewCouponAmount(): Boolean = newCouponAmount != null + fun isAmount(): Boolean = amount != null - fun asNewCouponPercentage(): NewCouponPercentageDiscount = - newCouponPercentage.getOrThrow("newCouponPercentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asNewCouponAmount(): NewCouponAmountDiscount = - newCouponAmount.getOrThrow("newCouponAmount") + fun asAmount(): Amount = amount.getOrThrow("amount") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newCouponPercentage != null -> visitor.visitNewCouponPercentage(newCouponPercentage) - newCouponAmount != null -> visitor.visitNewCouponAmount(newCouponAmount) + percentage != null -> visitor.visitPercentage(percentage) + amount != null -> visitor.visitAmount(amount) else -> visitor.unknown(_json) } @@ -817,14 +795,12 @@ private constructor( accept( object : Visitor { - override fun visitNewCouponPercentage( - newCouponPercentage: NewCouponPercentageDiscount - ) { - newCouponPercentage.validate() + override fun visitPercentage(percentage: Percentage) { + percentage.validate() } - override fun visitNewCouponAmount(newCouponAmount: NewCouponAmountDiscount) { - newCouponAmount.validate() + override fun visitAmount(amount: Amount) { + amount.validate() } } ) @@ -849,12 +825,9 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewCouponPercentage( - newCouponPercentage: NewCouponPercentageDiscount - ) = newCouponPercentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitNewCouponAmount(newCouponAmount: NewCouponAmountDiscount) = - newCouponAmount.validity() + override fun visitAmount(amount: Amount) = amount.validity() override fun unknown(json: JsonValue?) = 0 } @@ -865,28 +838,24 @@ private constructor( return true } - return /* spotless:off */ other is Discount && newCouponPercentage == other.newCouponPercentage && newCouponAmount == other.newCouponAmount /* spotless:on */ + return /* spotless:off */ other is Discount && percentage == other.percentage && amount == other.amount /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newCouponPercentage, newCouponAmount) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentage, amount) /* spotless:on */ override fun toString(): String = when { - newCouponPercentage != null -> "Discount{newCouponPercentage=$newCouponPercentage}" - newCouponAmount != null -> "Discount{newCouponAmount=$newCouponAmount}" + percentage != null -> "Discount{percentage=$percentage}" + amount != null -> "Discount{amount=$amount}" _json != null -> "Discount{_unknown=$_json}" else -> throw IllegalStateException("Invalid Discount") } companion object { - @JvmStatic - fun ofNewCouponPercentage(newCouponPercentage: NewCouponPercentageDiscount) = - Discount(newCouponPercentage = newCouponPercentage) + @JvmStatic fun ofPercentage(percentage: Percentage) = Discount(percentage = percentage) - @JvmStatic - fun ofNewCouponAmount(newCouponAmount: NewCouponAmountDiscount) = - Discount(newCouponAmount = newCouponAmount) + @JvmStatic fun ofAmount(amount: Amount) = Discount(amount = amount) } /** @@ -894,9 +863,9 @@ private constructor( */ interface Visitor { - fun visitNewCouponPercentage(newCouponPercentage: NewCouponPercentageDiscount): T + fun visitPercentage(percentage: Percentage): T - fun visitNewCouponAmount(newCouponAmount: NewCouponAmountDiscount): T + fun visitAmount(amount: Amount): T /** * Maps an unknown variant of [Discount] to a value of type [T]. @@ -922,14 +891,14 @@ private constructor( when (discountType) { "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Discount(newCouponPercentage = it, _json = json) } - ?: Discount(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Discount(percentage = it, _json = json) + } ?: Discount(_json = json) } "amount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Discount(newCouponAmount = it, _json = json) } - ?: Discount(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Discount(amount = it, _json = json) + } ?: Discount(_json = json) } } @@ -945,16 +914,15 @@ private constructor( provider: SerializerProvider, ) { when { - value.newCouponPercentage != null -> - generator.writeObject(value.newCouponPercentage) - value.newCouponAmount != null -> generator.writeObject(value.newCouponAmount) + value.percentage != null -> generator.writeObject(value.percentage) + value.amount != null -> generator.writeObject(value.amount) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Discount") } } } - class NewCouponPercentageDiscount + class Percentage private constructor( private val discountType: JsonValue, private val percentageDiscount: JsonField, @@ -1016,8 +984,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewCouponPercentageDiscount]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -1027,7 +994,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewCouponPercentageDiscount]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var discountType: JsonValue = JsonValue.from("percentage") @@ -1035,13 +1002,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newCouponPercentageDiscount: NewCouponPercentageDiscount) = - apply { - discountType = newCouponPercentageDiscount.discountType - percentageDiscount = newCouponPercentageDiscount.percentageDiscount - additionalProperties = - newCouponPercentageDiscount.additionalProperties.toMutableMap() - } + internal fun from(percentage: Percentage) = apply { + discountType = percentage.discountType + percentageDiscount = percentage.percentageDiscount + additionalProperties = percentage.additionalProperties.toMutableMap() + } /** * Sets the field to an arbitrary JSON value. @@ -1096,7 +1061,7 @@ private constructor( } /** - * Returns an immutable instance of [NewCouponPercentageDiscount]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -1107,8 +1072,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewCouponPercentageDiscount = - NewCouponPercentageDiscount( + fun build(): Percentage = + Percentage( discountType, checkRequired("percentageDiscount", percentageDiscount), additionalProperties.toMutableMap(), @@ -1117,7 +1082,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewCouponPercentageDiscount = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -1155,7 +1120,7 @@ private constructor( return true } - return /* spotless:off */ other is NewCouponPercentageDiscount && discountType == other.discountType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Percentage && discountType == other.discountType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1165,10 +1130,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewCouponPercentageDiscount{discountType=$discountType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "Percentage{discountType=$discountType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" } - class NewCouponAmountDiscount + class Amount private constructor( private val amountDiscount: JsonField, private val discountType: JsonValue, @@ -1230,8 +1195,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewCouponAmountDiscount]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -1241,7 +1205,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewCouponAmountDiscount]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -1249,11 +1213,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newCouponAmountDiscount: NewCouponAmountDiscount) = apply { - amountDiscount = newCouponAmountDiscount.amountDiscount - discountType = newCouponAmountDiscount.discountType - additionalProperties = - newCouponAmountDiscount.additionalProperties.toMutableMap() + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + discountType = amount.discountType + additionalProperties = amount.additionalProperties.toMutableMap() } fun amountDiscount(amountDiscount: String) = @@ -1309,7 +1272,7 @@ private constructor( } /** - * Returns an immutable instance of [NewCouponAmountDiscount]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -1320,8 +1283,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewCouponAmountDiscount = - NewCouponAmountDiscount( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), discountType, additionalProperties.toMutableMap(), @@ -1330,7 +1293,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewCouponAmountDiscount = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -1368,7 +1331,7 @@ private constructor( return true } - return /* spotless:off */ other is NewCouponAmountDiscount && amountDiscount == other.amountDiscount && discountType == other.discountType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Amount && amountDiscount == other.amountDiscount && discountType == other.discountType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1378,7 +1341,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewCouponAmountDiscount{amountDiscount=$amountDiscount, discountType=$discountType, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, discountType=$discountType, additionalProperties=$additionalProperties}" } } 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 12365755b..dc76df2cc 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 @@ -657,156 +657,154 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = - price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with * `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** * Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** * Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** * Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice - ) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** The price the cost is associated with */ 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 584c4318e..ad7f69500 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 @@ -653,156 +653,154 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = - price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with * `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** * Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** * Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** * Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice - ) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** The price the cost is associated with */ 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 ba80d01ad..8f0bb93b1 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 @@ -822,40 +822,38 @@ private constructor( body.taxConfiguration(taxConfiguration) } - /** - * Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewAvalara(newAvalara)`. - */ - fun taxConfiguration(newAvalara: TaxConfiguration.NewAvalaraTaxConfiguration) = apply { - body.taxConfiguration(newAvalara) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofAvalara(avalara)`. */ + fun taxConfiguration(avalara: TaxConfiguration.Avalara) = apply { + body.taxConfiguration(avalara) } /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewAvalaraTaxConfiguration.builder() + * TaxConfiguration.Avalara.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newAvalaraTaxConfiguration(taxExempt: Boolean) = apply { - body.newAvalaraTaxConfiguration(taxExempt) + fun avalaraTaxConfiguration(taxExempt: Boolean) = apply { + body.avalaraTaxConfiguration(taxExempt) } - /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewTaxJar(newTaxJar)`. */ - fun taxConfiguration(newTaxJar: TaxConfiguration.NewTaxJarConfiguration) = apply { - body.taxConfiguration(newTaxJar) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofTaxjar(taxjar)`. */ + fun taxConfiguration(taxjar: TaxConfiguration.Taxjar) = apply { + body.taxConfiguration(taxjar) } /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewTaxJarConfiguration.builder() + * TaxConfiguration.Taxjar.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newTaxJarTaxConfiguration(taxExempt: Boolean) = apply { - body.newTaxJarTaxConfiguration(taxExempt) + fun taxjarTaxConfiguration(taxExempt: Boolean) = apply { + body.taxjarTaxConfiguration(taxExempt) } /** @@ -2068,46 +2066,35 @@ private constructor( this.taxConfiguration = taxConfiguration } - /** - * Alias for calling [taxConfiguration] with - * `TaxConfiguration.ofNewAvalara(newAvalara)`. - */ - fun taxConfiguration(newAvalara: TaxConfiguration.NewAvalaraTaxConfiguration) = - taxConfiguration(TaxConfiguration.ofNewAvalara(newAvalara)) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofAvalara(avalara)`. */ + fun taxConfiguration(avalara: TaxConfiguration.Avalara) = + taxConfiguration(TaxConfiguration.ofAvalara(avalara)) /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewAvalaraTaxConfiguration.builder() + * TaxConfiguration.Avalara.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newAvalaraTaxConfiguration(taxExempt: Boolean) = - taxConfiguration( - TaxConfiguration.NewAvalaraTaxConfiguration.builder() - .taxExempt(taxExempt) - .build() - ) + fun avalaraTaxConfiguration(taxExempt: Boolean) = + taxConfiguration(TaxConfiguration.Avalara.builder().taxExempt(taxExempt).build()) - /** - * Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewTaxJar(newTaxJar)`. - */ - fun taxConfiguration(newTaxJar: TaxConfiguration.NewTaxJarConfiguration) = - taxConfiguration(TaxConfiguration.ofNewTaxJar(newTaxJar)) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofTaxjar(taxjar)`. */ + fun taxConfiguration(taxjar: TaxConfiguration.Taxjar) = + taxConfiguration(TaxConfiguration.ofTaxjar(taxjar)) /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewTaxJarConfiguration.builder() + * TaxConfiguration.Taxjar.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newTaxJarTaxConfiguration(taxExempt: Boolean) = - taxConfiguration( - TaxConfiguration.NewTaxJarConfiguration.builder().taxExempt(taxExempt).build() - ) + fun taxjarTaxConfiguration(taxExempt: Boolean) = + taxConfiguration(TaxConfiguration.Taxjar.builder().taxExempt(taxExempt).build()) /** * Tax IDs are commonly required to be displayed on customer invoices, which are added @@ -4096,29 +4083,29 @@ private constructor( @JsonSerialize(using = TaxConfiguration.Serializer::class) class TaxConfiguration private constructor( - private val newAvalara: NewAvalaraTaxConfiguration? = null, - private val newTaxJar: NewTaxJarConfiguration? = null, + private val avalara: Avalara? = null, + private val taxjar: Taxjar? = null, private val _json: JsonValue? = null, ) { - fun newAvalara(): Optional = Optional.ofNullable(newAvalara) + fun avalara(): Optional = Optional.ofNullable(avalara) - fun newTaxJar(): Optional = Optional.ofNullable(newTaxJar) + fun taxjar(): Optional = Optional.ofNullable(taxjar) - fun isNewAvalara(): Boolean = newAvalara != null + fun isAvalara(): Boolean = avalara != null - fun isNewTaxJar(): Boolean = newTaxJar != null + fun isTaxjar(): Boolean = taxjar != null - fun asNewAvalara(): NewAvalaraTaxConfiguration = newAvalara.getOrThrow("newAvalara") + fun asAvalara(): Avalara = avalara.getOrThrow("avalara") - fun asNewTaxJar(): NewTaxJarConfiguration = newTaxJar.getOrThrow("newTaxJar") + fun asTaxjar(): Taxjar = taxjar.getOrThrow("taxjar") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newAvalara != null -> visitor.visitNewAvalara(newAvalara) - newTaxJar != null -> visitor.visitNewTaxJar(newTaxJar) + avalara != null -> visitor.visitAvalara(avalara) + taxjar != null -> visitor.visitTaxjar(taxjar) else -> visitor.unknown(_json) } @@ -4131,12 +4118,12 @@ private constructor( accept( object : Visitor { - override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) { - newAvalara.validate() + override fun visitAvalara(avalara: Avalara) { + avalara.validate() } - override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) { - newTaxJar.validate() + override fun visitTaxjar(taxjar: Taxjar) { + taxjar.validate() } } ) @@ -4161,11 +4148,9 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) = - newAvalara.validity() + override fun visitAvalara(avalara: Avalara) = avalara.validity() - override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) = - newTaxJar.validity() + override fun visitTaxjar(taxjar: Taxjar) = taxjar.validity() override fun unknown(json: JsonValue?) = 0 } @@ -4176,28 +4161,24 @@ private constructor( return true } - return /* spotless:off */ other is TaxConfiguration && newAvalara == other.newAvalara && newTaxJar == other.newTaxJar /* spotless:on */ + return /* spotless:off */ other is TaxConfiguration && avalara == other.avalara && taxjar == other.taxjar /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newAvalara, newTaxJar) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(avalara, taxjar) /* spotless:on */ override fun toString(): String = when { - newAvalara != null -> "TaxConfiguration{newAvalara=$newAvalara}" - newTaxJar != null -> "TaxConfiguration{newTaxJar=$newTaxJar}" + avalara != null -> "TaxConfiguration{avalara=$avalara}" + taxjar != null -> "TaxConfiguration{taxjar=$taxjar}" _json != null -> "TaxConfiguration{_unknown=$_json}" else -> throw IllegalStateException("Invalid TaxConfiguration") } companion object { - @JvmStatic - fun ofNewAvalara(newAvalara: NewAvalaraTaxConfiguration) = - TaxConfiguration(newAvalara = newAvalara) + @JvmStatic fun ofAvalara(avalara: Avalara) = TaxConfiguration(avalara = avalara) - @JvmStatic - fun ofNewTaxJar(newTaxJar: NewTaxJarConfiguration) = - TaxConfiguration(newTaxJar = newTaxJar) + @JvmStatic fun ofTaxjar(taxjar: Taxjar) = TaxConfiguration(taxjar = taxjar) } /** @@ -4206,9 +4187,9 @@ private constructor( */ interface Visitor { - fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration): T + fun visitAvalara(avalara: Avalara): T - fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration): T + fun visitTaxjar(taxjar: Taxjar): T /** * Maps an unknown variant of [TaxConfiguration] to a value of type [T]. @@ -4234,13 +4215,13 @@ private constructor( when (taxProvider) { "avalara" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { TaxConfiguration(newAvalara = it, _json = json) } - ?: TaxConfiguration(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + TaxConfiguration(avalara = it, _json = json) + } ?: TaxConfiguration(_json = json) } "taxjar" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - TaxConfiguration(newTaxJar = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + TaxConfiguration(taxjar = it, _json = json) } ?: TaxConfiguration(_json = json) } } @@ -4257,15 +4238,15 @@ private constructor( provider: SerializerProvider, ) { when { - value.newAvalara != null -> generator.writeObject(value.newAvalara) - value.newTaxJar != null -> generator.writeObject(value.newTaxJar) + value.avalara != null -> generator.writeObject(value.avalara) + value.taxjar != null -> generator.writeObject(value.taxjar) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid TaxConfiguration") } } } - class NewAvalaraTaxConfiguration + class Avalara private constructor( private val taxExempt: JsonField, private val taxProvider: JsonValue, @@ -4348,8 +4329,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAvalaraTaxConfiguration]. + * Returns a mutable builder for constructing an instance of [Avalara]. * * The following fields are required: * ```java @@ -4359,7 +4339,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAvalaraTaxConfiguration]. */ + /** A builder for [Avalara]. */ class Builder internal constructor() { private var taxExempt: JsonField? = null @@ -4368,12 +4348,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAvalaraTaxConfiguration: NewAvalaraTaxConfiguration) = apply { - taxExempt = newAvalaraTaxConfiguration.taxExempt - taxProvider = newAvalaraTaxConfiguration.taxProvider - taxExemptionCode = newAvalaraTaxConfiguration.taxExemptionCode - additionalProperties = - newAvalaraTaxConfiguration.additionalProperties.toMutableMap() + internal fun from(avalara: Avalara) = apply { + taxExempt = avalara.taxExempt + taxProvider = avalara.taxProvider + taxExemptionCode = avalara.taxExemptionCode + additionalProperties = avalara.additionalProperties.toMutableMap() } fun taxExempt(taxExempt: Boolean) = taxExempt(JsonField.of(taxExempt)) @@ -4445,7 +4424,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAvalaraTaxConfiguration]. + * Returns an immutable instance of [Avalara]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4456,8 +4435,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAvalaraTaxConfiguration = - NewAvalaraTaxConfiguration( + fun build(): Avalara = + Avalara( checkRequired("taxExempt", taxExempt), taxProvider, taxExemptionCode, @@ -4467,7 +4446,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAvalaraTaxConfiguration = apply { + fun validate(): Avalara = apply { if (validated) { return@apply } @@ -4507,7 +4486,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAvalaraTaxConfiguration && taxExempt == other.taxExempt && taxProvider == other.taxProvider && taxExemptionCode == other.taxExemptionCode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Avalara && taxExempt == other.taxExempt && taxProvider == other.taxProvider && taxExemptionCode == other.taxExemptionCode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4517,10 +4496,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAvalaraTaxConfiguration{taxExempt=$taxExempt, taxProvider=$taxProvider, taxExemptionCode=$taxExemptionCode, additionalProperties=$additionalProperties}" + "Avalara{taxExempt=$taxExempt, taxProvider=$taxProvider, taxExemptionCode=$taxExemptionCode, additionalProperties=$additionalProperties}" } - class NewTaxJarConfiguration + class Taxjar private constructor( private val taxExempt: JsonField, private val taxProvider: JsonValue, @@ -4582,8 +4561,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewTaxJarConfiguration]. + * Returns a mutable builder for constructing an instance of [Taxjar]. * * The following fields are required: * ```java @@ -4593,7 +4571,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewTaxJarConfiguration]. */ + /** A builder for [Taxjar]. */ class Builder internal constructor() { private var taxExempt: JsonField? = null @@ -4601,11 +4579,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newTaxJarConfiguration: NewTaxJarConfiguration) = apply { - taxExempt = newTaxJarConfiguration.taxExempt - taxProvider = newTaxJarConfiguration.taxProvider - additionalProperties = - newTaxJarConfiguration.additionalProperties.toMutableMap() + internal fun from(taxjar: Taxjar) = apply { + taxExempt = taxjar.taxExempt + taxProvider = taxjar.taxProvider + additionalProperties = taxjar.additionalProperties.toMutableMap() } fun taxExempt(taxExempt: Boolean) = taxExempt(JsonField.of(taxExempt)) @@ -4656,7 +4633,7 @@ private constructor( } /** - * Returns an immutable instance of [NewTaxJarConfiguration]. + * Returns an immutable instance of [Taxjar]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4667,8 +4644,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewTaxJarConfiguration = - NewTaxJarConfiguration( + fun build(): Taxjar = + Taxjar( checkRequired("taxExempt", taxExempt), taxProvider, additionalProperties.toMutableMap(), @@ -4677,7 +4654,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewTaxJarConfiguration = apply { + fun validate(): Taxjar = apply { if (validated) { return@apply } @@ -4715,7 +4692,7 @@ private constructor( return true } - return /* spotless:off */ other is NewTaxJarConfiguration && taxExempt == other.taxExempt && taxProvider == other.taxProvider && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Taxjar && taxExempt == other.taxExempt && taxProvider == other.taxProvider && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4725,7 +4702,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewTaxJarConfiguration{taxExempt=$taxExempt, taxProvider=$taxProvider, additionalProperties=$additionalProperties}" + "Taxjar{taxExempt=$taxExempt, taxProvider=$taxProvider, additionalProperties=$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 91f2d8e46..2bf2a5ed0 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 @@ -202,94 +202,41 @@ private constructor( fun body(body: Body) = apply { this.body = body } - /** - * Alias for calling [body] with - * `Body.ofAddIncrementCreditLedgerEntryRequestParams(addIncrementCreditLedgerEntryRequestParams)`. - */ - fun body( - addIncrementCreditLedgerEntryRequestParams: - Body.AddIncrementCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofIncrement(increment)`. */ + fun body(increment: Body.Increment) = body(Body.ofIncrement(increment)) /** * Alias for calling [body] with the following: * ```java - * Body.AddIncrementCreditLedgerEntryRequestParams.builder() + * Body.Increment.builder() * .amount(amount) * .build() * ``` */ - fun addIncrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body(Body.AddIncrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) + fun incrementBody(amount: Double) = body(Body.Increment.builder().amount(amount).build()) - /** - * Alias for calling [body] with - * `Body.ofAddDecrementCreditLedgerEntryRequestParams(addDecrementCreditLedgerEntryRequestParams)`. - */ - fun body( - addDecrementCreditLedgerEntryRequestParams: - Body.AddDecrementCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofDecrement(decrement)`. */ + fun body(decrement: Body.Decrement) = body(Body.ofDecrement(decrement)) /** * Alias for calling [body] with the following: * ```java - * Body.AddDecrementCreditLedgerEntryRequestParams.builder() + * Body.Decrement.builder() * .amount(amount) * .build() * ``` */ - fun addDecrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body(Body.AddDecrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) + fun decrementBody(amount: Double) = body(Body.Decrement.builder().amount(amount).build()) - /** - * Alias for calling [body] with - * `Body.ofAddExpirationChangeCreditLedgerEntryRequestParams(addExpirationChangeCreditLedgerEntryRequestParams)`. - */ - fun body( - addExpirationChangeCreditLedgerEntryRequestParams: - Body.AddExpirationChangeCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofExpirationChange(expirationChange)`. */ + fun body(expirationChange: Body.ExpirationChange) = + body(Body.ofExpirationChange(expirationChange)) - /** - * Alias for calling [body] with - * `Body.ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams)`. - */ - fun body( - addVoidCreditLedgerEntryRequestParams: Body.AddVoidCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams) - ) + /** Alias for calling [body] with `Body.ofVoid(void_)`. */ + fun body(void_: Body.Void) = body(Body.ofVoid(void_)) - /** - * Alias for calling [body] with - * `Body.ofAddAmendmentCreditLedgerEntryRequestParams(addAmendmentCreditLedgerEntryRequestParams)`. - */ - fun body( - addAmendmentCreditLedgerEntryRequestParams: - Body.AddAmendmentCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofAmendment(amendment)`. */ + fun body(amendment: Body.Amendment) = body(Body.ofAmendment(amendment)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -426,111 +373,53 @@ private constructor( @JsonSerialize(using = Body.Serializer::class) class Body private constructor( - private val addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams? = - null, - private val addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams? = - null, - private val addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams? = - null, - private val addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams? = - null, - private val addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams? = - null, + private val increment: Increment? = null, + private val decrement: Decrement? = null, + private val expirationChange: ExpirationChange? = null, + private val void_: Void? = null, + private val amendment: Amendment? = null, private val _json: JsonValue? = null, ) { - fun addIncrementCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addIncrementCreditLedgerEntryRequestParams) + fun increment(): Optional = Optional.ofNullable(increment) - fun addDecrementCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addDecrementCreditLedgerEntryRequestParams) + fun decrement(): Optional = Optional.ofNullable(decrement) - fun addExpirationChangeCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addExpirationChangeCreditLedgerEntryRequestParams) + fun expirationChange(): Optional = Optional.ofNullable(expirationChange) - fun addVoidCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addVoidCreditLedgerEntryRequestParams) + fun void_(): Optional = Optional.ofNullable(void_) - fun addAmendmentCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addAmendmentCreditLedgerEntryRequestParams) + fun amendment(): Optional = Optional.ofNullable(amendment) - fun isAddIncrementCreditLedgerEntryRequestParams(): Boolean = - addIncrementCreditLedgerEntryRequestParams != null + fun isIncrement(): Boolean = increment != null - fun isAddDecrementCreditLedgerEntryRequestParams(): Boolean = - addDecrementCreditLedgerEntryRequestParams != null + fun isDecrement(): Boolean = decrement != null - fun isAddExpirationChangeCreditLedgerEntryRequestParams(): Boolean = - addExpirationChangeCreditLedgerEntryRequestParams != null + fun isExpirationChange(): Boolean = expirationChange != null - fun isAddVoidCreditLedgerEntryRequestParams(): Boolean = - addVoidCreditLedgerEntryRequestParams != null + fun isVoid(): Boolean = void_ != null - fun isAddAmendmentCreditLedgerEntryRequestParams(): Boolean = - addAmendmentCreditLedgerEntryRequestParams != null + fun isAmendment(): Boolean = amendment != null - fun asAddIncrementCreditLedgerEntryRequestParams(): - AddIncrementCreditLedgerEntryRequestParams = - addIncrementCreditLedgerEntryRequestParams.getOrThrow( - "addIncrementCreditLedgerEntryRequestParams" - ) + fun asIncrement(): Increment = increment.getOrThrow("increment") - fun asAddDecrementCreditLedgerEntryRequestParams(): - AddDecrementCreditLedgerEntryRequestParams = - addDecrementCreditLedgerEntryRequestParams.getOrThrow( - "addDecrementCreditLedgerEntryRequestParams" - ) + fun asDecrement(): Decrement = decrement.getOrThrow("decrement") - fun asAddExpirationChangeCreditLedgerEntryRequestParams(): - AddExpirationChangeCreditLedgerEntryRequestParams = - addExpirationChangeCreditLedgerEntryRequestParams.getOrThrow( - "addExpirationChangeCreditLedgerEntryRequestParams" - ) + fun asExpirationChange(): ExpirationChange = expirationChange.getOrThrow("expirationChange") - fun asAddVoidCreditLedgerEntryRequestParams(): AddVoidCreditLedgerEntryRequestParams = - addVoidCreditLedgerEntryRequestParams.getOrThrow( - "addVoidCreditLedgerEntryRequestParams" - ) + fun asVoid(): Void = void_.getOrThrow("void_") - fun asAddAmendmentCreditLedgerEntryRequestParams(): - AddAmendmentCreditLedgerEntryRequestParams = - addAmendmentCreditLedgerEntryRequestParams.getOrThrow( - "addAmendmentCreditLedgerEntryRequestParams" - ) + fun asAmendment(): Amendment = amendment.getOrThrow("amendment") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - addIncrementCreditLedgerEntryRequestParams != null -> - visitor.visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams - ) - addDecrementCreditLedgerEntryRequestParams != null -> - visitor.visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams - ) - addExpirationChangeCreditLedgerEntryRequestParams != null -> - visitor.visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams - ) - addVoidCreditLedgerEntryRequestParams != null -> - visitor.visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams - ) - addAmendmentCreditLedgerEntryRequestParams != null -> - visitor.visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams - ) + increment != null -> visitor.visitIncrement(increment) + decrement != null -> visitor.visitDecrement(decrement) + expirationChange != null -> visitor.visitExpirationChange(expirationChange) + void_ != null -> visitor.visitVoid(void_) + amendment != null -> visitor.visitAmendment(amendment) else -> visitor.unknown(_json) } @@ -543,38 +432,24 @@ private constructor( accept( object : Visitor { - override fun visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) { - addIncrementCreditLedgerEntryRequestParams.validate() + override fun visitIncrement(increment: Increment) { + increment.validate() } - override fun visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) { - addDecrementCreditLedgerEntryRequestParams.validate() + override fun visitDecrement(decrement: Decrement) { + decrement.validate() } - override fun visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) { - addExpirationChangeCreditLedgerEntryRequestParams.validate() + override fun visitExpirationChange(expirationChange: ExpirationChange) { + expirationChange.validate() } - override fun visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) { - addVoidCreditLedgerEntryRequestParams.validate() + override fun visitVoid(void_: Void) { + void_.validate() } - override fun visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) { - addAmendmentCreditLedgerEntryRequestParams.validate() + override fun visitAmendment(amendment: Amendment) { + amendment.validate() } } ) @@ -599,29 +474,16 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) = addIncrementCreditLedgerEntryRequestParams.validity() - - override fun visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) = addDecrementCreditLedgerEntryRequestParams.validity() - - override fun visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = addExpirationChangeCreditLedgerEntryRequestParams.validity() - - override fun visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = addVoidCreditLedgerEntryRequestParams.validity() - - override fun visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) = addAmendmentCreditLedgerEntryRequestParams.validity() + override fun visitIncrement(increment: Increment) = increment.validity() + + override fun visitDecrement(decrement: Decrement) = decrement.validity() + + override fun visitExpirationChange(expirationChange: ExpirationChange) = + expirationChange.validity() + + override fun visitVoid(void_: Void) = void_.validity() + + override fun visitAmendment(amendment: Amendment) = amendment.validity() override fun unknown(json: JsonValue?) = 0 } @@ -632,101 +494,49 @@ private constructor( return true } - return /* spotless:off */ other is Body && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */ + return /* spotless:off */ other is Body && increment == other.increment && decrement == other.decrement && expirationChange == other.expirationChange && void_ == other.void_ && amendment == other.amendment /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(increment, decrement, expirationChange, void_, amendment) /* spotless:on */ override fun toString(): String = when { - addIncrementCreditLedgerEntryRequestParams != null -> - "Body{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}" - addDecrementCreditLedgerEntryRequestParams != null -> - "Body{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}" - addExpirationChangeCreditLedgerEntryRequestParams != null -> - "Body{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}" - addVoidCreditLedgerEntryRequestParams != null -> - "Body{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}" - addAmendmentCreditLedgerEntryRequestParams != null -> - "Body{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}" + increment != null -> "Body{increment=$increment}" + decrement != null -> "Body{decrement=$decrement}" + expirationChange != null -> "Body{expirationChange=$expirationChange}" + void_ != null -> "Body{void_=$void_}" + amendment != null -> "Body{amendment=$amendment}" _json != null -> "Body{_unknown=$_json}" else -> throw IllegalStateException("Invalid Body") } companion object { - @JvmStatic - fun ofAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) = - Body( - addIncrementCreditLedgerEntryRequestParams = - addIncrementCreditLedgerEntryRequestParams - ) + @JvmStatic fun ofIncrement(increment: Increment) = Body(increment = increment) - @JvmStatic - fun ofAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) = - Body( - addDecrementCreditLedgerEntryRequestParams = - addDecrementCreditLedgerEntryRequestParams - ) + @JvmStatic fun ofDecrement(decrement: Decrement) = Body(decrement = decrement) @JvmStatic - fun ofAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = - Body( - addExpirationChangeCreditLedgerEntryRequestParams = - addExpirationChangeCreditLedgerEntryRequestParams - ) + fun ofExpirationChange(expirationChange: ExpirationChange) = + Body(expirationChange = expirationChange) - @JvmStatic - fun ofAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = Body(addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams) + @JvmStatic fun ofVoid(void_: Void) = Body(void_ = void_) - @JvmStatic - fun ofAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) = - Body( - addAmendmentCreditLedgerEntryRequestParams = - addAmendmentCreditLedgerEntryRequestParams - ) + @JvmStatic fun ofAmendment(amendment: Amendment) = Body(amendment = amendment) } /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { - fun visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ): T + fun visitIncrement(increment: Increment): T - fun visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ): T + fun visitDecrement(decrement: Decrement): T - fun visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ): T + fun visitExpirationChange(expirationChange: ExpirationChange): T - fun visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ): T + fun visitVoid(void_: Void): T - fun visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ): T + fun visitAmendment(amendment: Amendment): T /** * Maps an unknown variant of [Body] to a value of type [T]. @@ -751,51 +561,29 @@ private constructor( when (entryType) { "increment" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(addIncrementCreditLedgerEntryRequestParams = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(increment = it, _json = json) + } ?: Body(_json = json) } "decrement" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(addDecrementCreditLedgerEntryRequestParams = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(decrement = it, _json = json) + } ?: Body(_json = json) } "expiration_change" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body( - addExpirationChangeCreditLedgerEntryRequestParams = it, - _json = json, - ) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(expirationChange = it, _json = json) + } ?: Body(_json = json) } "void" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(addVoidCreditLedgerEntryRequestParams = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(void_ = it, _json = json) + } ?: Body(_json = json) } "amendment" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(addAmendmentCreditLedgerEntryRequestParams = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(amendment = it, _json = json) + } ?: Body(_json = json) } } @@ -811,25 +599,18 @@ private constructor( provider: SerializerProvider, ) { when { - value.addIncrementCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addIncrementCreditLedgerEntryRequestParams) - value.addDecrementCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addDecrementCreditLedgerEntryRequestParams) - value.addExpirationChangeCreditLedgerEntryRequestParams != null -> - generator.writeObject( - value.addExpirationChangeCreditLedgerEntryRequestParams - ) - value.addVoidCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addVoidCreditLedgerEntryRequestParams) - value.addAmendmentCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addAmendmentCreditLedgerEntryRequestParams) + value.increment != null -> generator.writeObject(value.increment) + value.decrement != null -> generator.writeObject(value.decrement) + value.expirationChange != null -> generator.writeObject(value.expirationChange) + value.void_ != null -> generator.writeObject(value.void_) + value.amendment != null -> generator.writeObject(value.amendment) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Body") } } } - class AddIncrementCreditLedgerEntryRequestParams + class Increment private constructor( private val amount: JsonField, private val entryType: JsonValue, @@ -1062,8 +843,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddIncrementCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Increment]. * * The following fields are required: * ```java @@ -1073,7 +853,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */ + /** A builder for [Increment]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -1088,22 +868,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) = apply { - amount = addIncrementCreditLedgerEntryRequestParams.amount - entryType = addIncrementCreditLedgerEntryRequestParams.entryType - currency = addIncrementCreditLedgerEntryRequestParams.currency - description = addIncrementCreditLedgerEntryRequestParams.description - effectiveDate = addIncrementCreditLedgerEntryRequestParams.effectiveDate - expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate - invoiceSettings = addIncrementCreditLedgerEntryRequestParams.invoiceSettings - metadata = addIncrementCreditLedgerEntryRequestParams.metadata - perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis - additionalProperties = - addIncrementCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(increment: Increment) = apply { + amount = increment.amount + entryType = increment.entryType + currency = increment.currency + description = increment.description + effectiveDate = increment.effectiveDate + expiryDate = increment.expiryDate + invoiceSettings = increment.invoiceSettings + metadata = increment.metadata + perUnitCostBasis = increment.perUnitCostBasis + additionalProperties = increment.additionalProperties.toMutableMap() } /** @@ -1309,7 +1084,7 @@ private constructor( } /** - * Returns an immutable instance of [AddIncrementCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Increment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -1320,8 +1095,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddIncrementCreditLedgerEntryRequestParams = - AddIncrementCreditLedgerEntryRequestParams( + fun build(): Increment = + Increment( checkRequired("amount", amount), entryType, currency, @@ -1337,7 +1112,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply { + fun validate(): Increment = apply { if (validated) { return@apply } @@ -1817,7 +1592,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Increment && 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 */ @@ -1827,10 +1602,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" + "Increment{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" } - class AddDecrementCreditLedgerEntryRequestParams + class Decrement private constructor( private val amount: JsonField, private val entryType: JsonValue, @@ -1957,8 +1732,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddDecrementCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Decrement]. * * The following fields are required: * ```java @@ -1968,7 +1742,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddDecrementCreditLedgerEntryRequestParams]. */ + /** A builder for [Decrement]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -1979,18 +1753,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) = apply { - amount = addDecrementCreditLedgerEntryRequestParams.amount - entryType = addDecrementCreditLedgerEntryRequestParams.entryType - currency = addDecrementCreditLedgerEntryRequestParams.currency - description = addDecrementCreditLedgerEntryRequestParams.description - metadata = addDecrementCreditLedgerEntryRequestParams.metadata - additionalProperties = - addDecrementCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(decrement: Decrement) = apply { + amount = decrement.amount + entryType = decrement.entryType + currency = decrement.currency + description = decrement.description + metadata = decrement.metadata + additionalProperties = decrement.additionalProperties.toMutableMap() } /** @@ -2105,7 +1874,7 @@ private constructor( } /** - * Returns an immutable instance of [AddDecrementCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Decrement]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2116,8 +1885,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddDecrementCreditLedgerEntryRequestParams = - AddDecrementCreditLedgerEntryRequestParams( + fun build(): Decrement = + Decrement( checkRequired("amount", amount), entryType, currency, @@ -2129,7 +1898,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddDecrementCreditLedgerEntryRequestParams = apply { + fun validate(): Decrement = apply { if (validated) { return@apply } @@ -2284,7 +2053,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Decrement && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2294,10 +2063,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "Decrement{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } - class AddExpirationChangeCreditLedgerEntryRequestParams + class ExpirationChange private constructor( private val entryType: JsonValue, private val expiryDate: JsonField, @@ -2499,8 +2268,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddExpirationChangeCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [ExpirationChange]. * * The following fields are required: * ```java @@ -2511,7 +2279,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ + /** A builder for [ExpirationChange]. */ class Builder internal constructor() { private var entryType: JsonValue = JsonValue.from("expiration_change") @@ -2525,22 +2293,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = apply { - entryType = addExpirationChangeCreditLedgerEntryRequestParams.entryType - expiryDate = addExpirationChangeCreditLedgerEntryRequestParams.expiryDate - targetExpiryDate = - addExpirationChangeCreditLedgerEntryRequestParams.targetExpiryDate - amount = addExpirationChangeCreditLedgerEntryRequestParams.amount - blockId = addExpirationChangeCreditLedgerEntryRequestParams.blockId - currency = addExpirationChangeCreditLedgerEntryRequestParams.currency - description = addExpirationChangeCreditLedgerEntryRequestParams.description - metadata = addExpirationChangeCreditLedgerEntryRequestParams.metadata - additionalProperties = - addExpirationChangeCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(expirationChange: ExpirationChange) = apply { + entryType = expirationChange.entryType + expiryDate = expirationChange.expiryDate + targetExpiryDate = expirationChange.targetExpiryDate + amount = expirationChange.amount + blockId = expirationChange.blockId + currency = expirationChange.currency + description = expirationChange.description + metadata = expirationChange.metadata + additionalProperties = expirationChange.additionalProperties.toMutableMap() } /** @@ -2723,8 +2485,7 @@ private constructor( } /** - * Returns an immutable instance of - * [AddExpirationChangeCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [ExpirationChange]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2736,8 +2497,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = - AddExpirationChangeCreditLedgerEntryRequestParams( + fun build(): ExpirationChange = + ExpirationChange( entryType, checkRequired("expiryDate", expiryDate), checkRequired("targetExpiryDate", targetExpiryDate), @@ -2752,7 +2513,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddExpirationChangeCreditLedgerEntryRequestParams = apply { + fun validate(): ExpirationChange = apply { if (validated) { return@apply } @@ -2913,7 +2674,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ExpirationChange && 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 */ @@ -2923,10 +2684,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "ExpirationChange{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } - class AddVoidCreditLedgerEntryRequestParams + class Void private constructor( private val amount: JsonField, private val blockId: JsonField, @@ -3104,8 +2865,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddVoidCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Void]. * * The following fields are required: * ```java @@ -3116,7 +2876,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddVoidCreditLedgerEntryRequestParams]. */ + /** A builder for [Void]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -3129,18 +2889,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = apply { - amount = addVoidCreditLedgerEntryRequestParams.amount - blockId = addVoidCreditLedgerEntryRequestParams.blockId - entryType = addVoidCreditLedgerEntryRequestParams.entryType - currency = addVoidCreditLedgerEntryRequestParams.currency - description = addVoidCreditLedgerEntryRequestParams.description - metadata = addVoidCreditLedgerEntryRequestParams.metadata - voidReason = addVoidCreditLedgerEntryRequestParams.voidReason - additionalProperties = - addVoidCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() + internal fun from(void_: Void) = apply { + amount = void_.amount + blockId = void_.blockId + entryType = void_.entryType + currency = void_.currency + description = void_.description + metadata = void_.metadata + voidReason = void_.voidReason + additionalProperties = void_.additionalProperties.toMutableMap() } /** @@ -3286,7 +3043,7 @@ private constructor( } /** - * Returns an immutable instance of [AddVoidCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Void]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3298,8 +3055,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddVoidCreditLedgerEntryRequestParams = - AddVoidCreditLedgerEntryRequestParams( + fun build(): Void = + Void( checkRequired("amount", amount), checkRequired("blockId", blockId), entryType, @@ -3313,7 +3070,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddVoidCreditLedgerEntryRequestParams = apply { + fun validate(): Void = apply { if (validated) { return@apply } @@ -3599,7 +3356,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Void && 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 */ @@ -3609,10 +3366,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" + "Void{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" } - class AddAmendmentCreditLedgerEntryRequestParams + class Amendment private constructor( private val amount: JsonField, private val blockId: JsonField, @@ -3759,8 +3516,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddAmendmentCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Amendment]. * * The following fields are required: * ```java @@ -3771,7 +3527,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddAmendmentCreditLedgerEntryRequestParams]. */ + /** A builder for [Amendment]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -3783,19 +3539,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) = apply { - amount = addAmendmentCreditLedgerEntryRequestParams.amount - blockId = addAmendmentCreditLedgerEntryRequestParams.blockId - entryType = addAmendmentCreditLedgerEntryRequestParams.entryType - currency = addAmendmentCreditLedgerEntryRequestParams.currency - description = addAmendmentCreditLedgerEntryRequestParams.description - metadata = addAmendmentCreditLedgerEntryRequestParams.metadata - additionalProperties = - addAmendmentCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(amendment: Amendment) = apply { + amount = amendment.amount + blockId = amendment.blockId + entryType = amendment.entryType + currency = amendment.currency + description = amendment.description + metadata = amendment.metadata + additionalProperties = amendment.additionalProperties.toMutableMap() } /** @@ -3922,7 +3673,7 @@ private constructor( } /** - * Returns an immutable instance of [AddAmendmentCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Amendment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3934,8 +3685,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddAmendmentCreditLedgerEntryRequestParams = - AddAmendmentCreditLedgerEntryRequestParams( + fun build(): Amendment = + Amendment( checkRequired("amount", amount), checkRequired("blockId", blockId), entryType, @@ -3948,7 +3699,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddAmendmentCreditLedgerEntryRequestParams = apply { + fun validate(): Amendment = apply { if (validated) { return@apply } @@ -4105,7 +3856,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amendment && 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 */ @@ -4115,7 +3866,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "Amendment{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } } 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 aecbbd5bd..d555e9b97 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 @@ -38,84 +38,69 @@ import kotlin.jvm.optionals.getOrNull @JsonSerialize(using = CustomerCreditLedgerCreateEntryByExternalIdResponse.Serializer::class) class CustomerCreditLedgerCreateEntryByExternalIdResponse private constructor( - private val incrementLedgerEntry: IncrementLedgerEntry? = null, - private val decrementLedgerEntry: DecrementLedgerEntry? = null, - private val expirationChangeLedgerEntry: ExpirationChangeLedgerEntry? = null, - private val creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry? = null, - private val voidLedgerEntry: VoidLedgerEntry? = null, - private val voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry? = null, - private val amendmentLedgerEntry: AmendmentLedgerEntry? = null, + private val increment: Increment? = null, + private val decrement: Decrement? = null, + private val expirationChange: ExpirationChange? = null, + private val creditBlockExpiry: CreditBlockExpiry? = null, + private val void_: Void? = null, + private val voidInitiated: VoidInitiated? = null, + private val amendment: Amendment? = null, private val _json: JsonValue? = null, ) { - fun incrementLedgerEntry(): Optional = - Optional.ofNullable(incrementLedgerEntry) + fun increment(): Optional = Optional.ofNullable(increment) - fun decrementLedgerEntry(): Optional = - Optional.ofNullable(decrementLedgerEntry) + fun decrement(): Optional = Optional.ofNullable(decrement) - fun expirationChangeLedgerEntry(): Optional = - Optional.ofNullable(expirationChangeLedgerEntry) + fun expirationChange(): Optional = Optional.ofNullable(expirationChange) - fun creditBlockExpiryLedgerEntry(): Optional = - Optional.ofNullable(creditBlockExpiryLedgerEntry) + fun creditBlockExpiry(): Optional = Optional.ofNullable(creditBlockExpiry) - fun voidLedgerEntry(): Optional = Optional.ofNullable(voidLedgerEntry) + fun void_(): Optional = Optional.ofNullable(void_) - fun voidInitiatedLedgerEntry(): Optional = - Optional.ofNullable(voidInitiatedLedgerEntry) + fun voidInitiated(): Optional = Optional.ofNullable(voidInitiated) - fun amendmentLedgerEntry(): Optional = - Optional.ofNullable(amendmentLedgerEntry) + fun amendment(): Optional = Optional.ofNullable(amendment) - fun isIncrementLedgerEntry(): Boolean = incrementLedgerEntry != null + fun isIncrement(): Boolean = increment != null - fun isDecrementLedgerEntry(): Boolean = decrementLedgerEntry != null + fun isDecrement(): Boolean = decrement != null - fun isExpirationChangeLedgerEntry(): Boolean = expirationChangeLedgerEntry != null + fun isExpirationChange(): Boolean = expirationChange != null - fun isCreditBlockExpiryLedgerEntry(): Boolean = creditBlockExpiryLedgerEntry != null + fun isCreditBlockExpiry(): Boolean = creditBlockExpiry != null - fun isVoidLedgerEntry(): Boolean = voidLedgerEntry != null + fun isVoid(): Boolean = void_ != null - fun isVoidInitiatedLedgerEntry(): Boolean = voidInitiatedLedgerEntry != null + fun isVoidInitiated(): Boolean = voidInitiated != null - fun isAmendmentLedgerEntry(): Boolean = amendmentLedgerEntry != null + fun isAmendment(): Boolean = amendment != null - fun asIncrementLedgerEntry(): IncrementLedgerEntry = - incrementLedgerEntry.getOrThrow("incrementLedgerEntry") + fun asIncrement(): Increment = increment.getOrThrow("increment") - fun asDecrementLedgerEntry(): DecrementLedgerEntry = - decrementLedgerEntry.getOrThrow("decrementLedgerEntry") + fun asDecrement(): Decrement = decrement.getOrThrow("decrement") - fun asExpirationChangeLedgerEntry(): ExpirationChangeLedgerEntry = - expirationChangeLedgerEntry.getOrThrow("expirationChangeLedgerEntry") + fun asExpirationChange(): ExpirationChange = expirationChange.getOrThrow("expirationChange") - fun asCreditBlockExpiryLedgerEntry(): CreditBlockExpiryLedgerEntry = - creditBlockExpiryLedgerEntry.getOrThrow("creditBlockExpiryLedgerEntry") + fun asCreditBlockExpiry(): CreditBlockExpiry = creditBlockExpiry.getOrThrow("creditBlockExpiry") - fun asVoidLedgerEntry(): VoidLedgerEntry = voidLedgerEntry.getOrThrow("voidLedgerEntry") + fun asVoid(): Void = void_.getOrThrow("void_") - fun asVoidInitiatedLedgerEntry(): VoidInitiatedLedgerEntry = - voidInitiatedLedgerEntry.getOrThrow("voidInitiatedLedgerEntry") + fun asVoidInitiated(): VoidInitiated = voidInitiated.getOrThrow("voidInitiated") - fun asAmendmentLedgerEntry(): AmendmentLedgerEntry = - amendmentLedgerEntry.getOrThrow("amendmentLedgerEntry") + fun asAmendment(): Amendment = amendment.getOrThrow("amendment") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry) - decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry) - expirationChangeLedgerEntry != null -> - visitor.visitExpirationChangeLedgerEntry(expirationChangeLedgerEntry) - creditBlockExpiryLedgerEntry != null -> - visitor.visitCreditBlockExpiryLedgerEntry(creditBlockExpiryLedgerEntry) - voidLedgerEntry != null -> visitor.visitVoidLedgerEntry(voidLedgerEntry) - voidInitiatedLedgerEntry != null -> - visitor.visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry) - amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry) + increment != null -> visitor.visitIncrement(increment) + decrement != null -> visitor.visitDecrement(decrement) + expirationChange != null -> visitor.visitExpirationChange(expirationChange) + creditBlockExpiry != null -> visitor.visitCreditBlockExpiry(creditBlockExpiry) + void_ != null -> visitor.visitVoid(void_) + voidInitiated != null -> visitor.visitVoidInitiated(voidInitiated) + amendment != null -> visitor.visitAmendment(amendment) else -> visitor.unknown(_json) } @@ -128,38 +113,32 @@ private constructor( accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) { - incrementLedgerEntry.validate() + override fun visitIncrement(increment: Increment) { + increment.validate() } - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) { - decrementLedgerEntry.validate() + override fun visitDecrement(decrement: Decrement) { + decrement.validate() } - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) { - expirationChangeLedgerEntry.validate() + override fun visitExpirationChange(expirationChange: ExpirationChange) { + expirationChange.validate() } - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) { - creditBlockExpiryLedgerEntry.validate() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) { + creditBlockExpiry.validate() } - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) { - voidLedgerEntry.validate() + override fun visitVoid(void_: Void) { + void_.validate() } - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) { - voidInitiatedLedgerEntry.validate() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) { + voidInitiated.validate() } - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) { - amendmentLedgerEntry.validate() + override fun visitAmendment(amendment: Amendment) { + amendment.validate() } } ) @@ -183,29 +162,22 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - incrementLedgerEntry.validity() + override fun visitIncrement(increment: Increment) = increment.validity() - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - decrementLedgerEntry.validity() + override fun visitDecrement(decrement: Decrement) = decrement.validity() - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = expirationChangeLedgerEntry.validity() + override fun visitExpirationChange(expirationChange: ExpirationChange) = + expirationChange.validity() - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = creditBlockExpiryLedgerEntry.validity() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + creditBlockExpiry.validity() - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - voidLedgerEntry.validity() + override fun visitVoid(void_: Void) = void_.validity() - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) = voidInitiatedLedgerEntry.validity() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) = + voidInitiated.validity() - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - amendmentLedgerEntry.validity() + override fun visitAmendment(amendment: Amendment) = amendment.validity() override fun unknown(json: JsonValue?) = 0 } @@ -216,27 +188,26 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdResponse && incrementLedgerEntry == other.incrementLedgerEntry && decrementLedgerEntry == other.decrementLedgerEntry && expirationChangeLedgerEntry == other.expirationChangeLedgerEntry && creditBlockExpiryLedgerEntry == other.creditBlockExpiryLedgerEntry && voidLedgerEntry == other.voidLedgerEntry && voidInitiatedLedgerEntry == other.voidInitiatedLedgerEntry && amendmentLedgerEntry == other.amendmentLedgerEntry /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdResponse && increment == other.increment && decrement == other.decrement && expirationChange == other.expirationChange && creditBlockExpiry == other.creditBlockExpiry && void_ == other.void_ && voidInitiated == other.voidInitiated && amendment == other.amendment /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(incrementLedgerEntry, decrementLedgerEntry, expirationChangeLedgerEntry, creditBlockExpiryLedgerEntry, voidLedgerEntry, voidInitiatedLedgerEntry, amendmentLedgerEntry) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(increment, decrement, expirationChange, creditBlockExpiry, void_, voidInitiated, amendment) /* spotless:on */ override fun toString(): String = when { - incrementLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{incrementLedgerEntry=$incrementLedgerEntry}" - decrementLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{decrementLedgerEntry=$decrementLedgerEntry}" - expirationChangeLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{expirationChangeLedgerEntry=$expirationChangeLedgerEntry}" - creditBlockExpiryLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{creditBlockExpiryLedgerEntry=$creditBlockExpiryLedgerEntry}" - voidLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{voidLedgerEntry=$voidLedgerEntry}" - voidInitiatedLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{voidInitiatedLedgerEntry=$voidInitiatedLedgerEntry}" - amendmentLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryByExternalIdResponse{amendmentLedgerEntry=$amendmentLedgerEntry}" + increment != null -> + "CustomerCreditLedgerCreateEntryByExternalIdResponse{increment=$increment}" + decrement != null -> + "CustomerCreditLedgerCreateEntryByExternalIdResponse{decrement=$decrement}" + expirationChange != null -> + "CustomerCreditLedgerCreateEntryByExternalIdResponse{expirationChange=$expirationChange}" + creditBlockExpiry != null -> + "CustomerCreditLedgerCreateEntryByExternalIdResponse{creditBlockExpiry=$creditBlockExpiry}" + void_ != null -> "CustomerCreditLedgerCreateEntryByExternalIdResponse{void_=$void_}" + voidInitiated != null -> + "CustomerCreditLedgerCreateEntryByExternalIdResponse{voidInitiated=$voidInitiated}" + amendment != null -> + "CustomerCreditLedgerCreateEntryByExternalIdResponse{amendment=$amendment}" _json != null -> "CustomerCreditLedgerCreateEntryByExternalIdResponse{_unknown=$_json}" else -> throw IllegalStateException( @@ -247,48 +218,33 @@ private constructor( companion object { @JvmStatic - fun ofIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - CustomerCreditLedgerCreateEntryByExternalIdResponse( - incrementLedgerEntry = incrementLedgerEntry - ) + fun ofIncrement(increment: Increment) = + CustomerCreditLedgerCreateEntryByExternalIdResponse(increment = increment) @JvmStatic - fun ofDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - CustomerCreditLedgerCreateEntryByExternalIdResponse( - decrementLedgerEntry = decrementLedgerEntry - ) + fun ofDecrement(decrement: Decrement) = + CustomerCreditLedgerCreateEntryByExternalIdResponse(decrement = decrement) @JvmStatic - fun ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = - CustomerCreditLedgerCreateEntryByExternalIdResponse( - expirationChangeLedgerEntry = expirationChangeLedgerEntry - ) + fun ofExpirationChange(expirationChange: ExpirationChange) = + CustomerCreditLedgerCreateEntryByExternalIdResponse(expirationChange = expirationChange) @JvmStatic - fun ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = + fun ofCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = CustomerCreditLedgerCreateEntryByExternalIdResponse( - creditBlockExpiryLedgerEntry = creditBlockExpiryLedgerEntry + creditBlockExpiry = creditBlockExpiry ) @JvmStatic - fun ofVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - CustomerCreditLedgerCreateEntryByExternalIdResponse(voidLedgerEntry = voidLedgerEntry) + fun ofVoid(void_: Void) = CustomerCreditLedgerCreateEntryByExternalIdResponse(void_ = void_) @JvmStatic - fun ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = - CustomerCreditLedgerCreateEntryByExternalIdResponse( - voidInitiatedLedgerEntry = voidInitiatedLedgerEntry - ) + fun ofVoidInitiated(voidInitiated: VoidInitiated) = + CustomerCreditLedgerCreateEntryByExternalIdResponse(voidInitiated = voidInitiated) @JvmStatic - fun ofAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - CustomerCreditLedgerCreateEntryByExternalIdResponse( - amendmentLedgerEntry = amendmentLedgerEntry - ) + fun ofAmendment(amendment: Amendment) = + CustomerCreditLedgerCreateEntryByExternalIdResponse(amendment = amendment) } /** @@ -297,23 +253,19 @@ private constructor( */ interface Visitor { - fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry): T + fun visitIncrement(increment: Increment): T - fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry): T + fun visitDecrement(decrement: Decrement): T - fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ): T + fun visitExpirationChange(expirationChange: ExpirationChange): T - fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ): T + fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry): T - fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry): T + fun visitVoid(void_: Void): T - fun visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry): T + fun visitVoidInitiated(voidInitiated: VoidInitiated): T - fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry): T + fun visitAmendment(amendment: Amendment): T /** * Maps an unknown variant of [CustomerCreditLedgerCreateEntryByExternalIdResponse] to a @@ -346,59 +298,57 @@ private constructor( when (entryType) { "increment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerCreateEntryByExternalIdResponse( - incrementLedgerEntry = it, + increment = it, _json = json, ) } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) } "decrement" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerCreateEntryByExternalIdResponse( - decrementLedgerEntry = it, + decrement = it, _json = json, ) } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) } "expiration_change" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerCreateEntryByExternalIdResponse( - expirationChangeLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryByExternalIdResponse( + expirationChange = it, + _json = json, + ) + } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) } "credit_block_expiry" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerCreateEntryByExternalIdResponse( - creditBlockExpiryLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryByExternalIdResponse( + creditBlockExpiry = it, + _json = json, + ) + } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) } "void" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerCreateEntryByExternalIdResponse( - voidLedgerEntry = it, + void_ = it, _json = json, ) } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) } "void_initiated" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerCreateEntryByExternalIdResponse( - voidInitiatedLedgerEntry = it, + voidInitiated = it, _json = json, ) } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) } "amendment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerCreateEntryByExternalIdResponse( - amendmentLedgerEntry = it, + amendment = it, _json = json, ) } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json) @@ -420,19 +370,13 @@ private constructor( provider: SerializerProvider, ) { when { - value.incrementLedgerEntry != null -> - generator.writeObject(value.incrementLedgerEntry) - value.decrementLedgerEntry != null -> - generator.writeObject(value.decrementLedgerEntry) - value.expirationChangeLedgerEntry != null -> - generator.writeObject(value.expirationChangeLedgerEntry) - value.creditBlockExpiryLedgerEntry != null -> - generator.writeObject(value.creditBlockExpiryLedgerEntry) - value.voidLedgerEntry != null -> generator.writeObject(value.voidLedgerEntry) - value.voidInitiatedLedgerEntry != null -> - generator.writeObject(value.voidInitiatedLedgerEntry) - value.amendmentLedgerEntry != null -> - generator.writeObject(value.amendmentLedgerEntry) + value.increment != null -> generator.writeObject(value.increment) + value.decrement != null -> generator.writeObject(value.decrement) + value.expirationChange != null -> generator.writeObject(value.expirationChange) + value.creditBlockExpiry != null -> generator.writeObject(value.creditBlockExpiry) + value.void_ != null -> generator.writeObject(value.void_) + value.voidInitiated != null -> generator.writeObject(value.voidInitiated) + value.amendment != null -> generator.writeObject(value.amendment) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException( @@ -442,7 +386,7 @@ private constructor( } } - class IncrementLedgerEntry + class Increment private constructor( private val id: JsonField, private val amount: JsonField, @@ -716,7 +660,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [IncrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Increment]. * * The following fields are required: * ```java @@ -737,7 +681,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [IncrementLedgerEntry]. */ + /** A builder for [Increment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -756,21 +700,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - id = incrementLedgerEntry.id - amount = incrementLedgerEntry.amount - createdAt = incrementLedgerEntry.createdAt - 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() + internal fun from(increment: Increment) = apply { + id = increment.id + amount = increment.amount + createdAt = increment.createdAt + creditBlock = increment.creditBlock + currency = increment.currency + customer = increment.customer + description = increment.description + endingBalance = increment.endingBalance + entryStatus = increment.entryStatus + entryType = increment.entryType + ledgerSequenceNumber = increment.ledgerSequenceNumber + metadata = increment.metadata + startingBalance = increment.startingBalance + additionalProperties = increment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -963,7 +907,7 @@ private constructor( } /** - * Returns an immutable instance of [IncrementLedgerEntry]. + * Returns an immutable instance of [Increment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -985,8 +929,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): IncrementLedgerEntry = - IncrementLedgerEntry( + fun build(): Increment = + Increment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -1006,7 +950,7 @@ private constructor( private var validated: Boolean = false - fun validate(): IncrementLedgerEntry = apply { + fun validate(): Increment = apply { if (validated) { return@apply } @@ -1769,7 +1713,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Increment && 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 */ @@ -1779,10 +1723,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Increment{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}" } - class DecrementLedgerEntry + class Decrement private constructor( private val id: JsonField, private val amount: JsonField, @@ -2106,7 +2050,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [DecrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Decrement]. * * The following fields are required: * ```java @@ -2127,7 +2071,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DecrementLedgerEntry]. */ + /** A builder for [Decrement]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2149,24 +2093,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - id = decrementLedgerEntry.id - amount = decrementLedgerEntry.amount - createdAt = decrementLedgerEntry.createdAt - creditBlock = decrementLedgerEntry.creditBlock - currency = decrementLedgerEntry.currency - customer = decrementLedgerEntry.customer - description = decrementLedgerEntry.description - endingBalance = decrementLedgerEntry.endingBalance - entryStatus = decrementLedgerEntry.entryStatus - entryType = decrementLedgerEntry.entryType - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - metadata = decrementLedgerEntry.metadata - startingBalance = decrementLedgerEntry.startingBalance - eventId = decrementLedgerEntry.eventId - invoiceId = decrementLedgerEntry.invoiceId - priceId = decrementLedgerEntry.priceId - additionalProperties = decrementLedgerEntry.additionalProperties.toMutableMap() + internal fun from(decrement: Decrement) = apply { + id = decrement.id + amount = decrement.amount + createdAt = decrement.createdAt + creditBlock = decrement.creditBlock + currency = decrement.currency + customer = decrement.customer + description = decrement.description + endingBalance = decrement.endingBalance + entryStatus = decrement.entryStatus + entryType = decrement.entryType + ledgerSequenceNumber = decrement.ledgerSequenceNumber + metadata = decrement.metadata + startingBalance = decrement.startingBalance + eventId = decrement.eventId + invoiceId = decrement.invoiceId + priceId = decrement.priceId + additionalProperties = decrement.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2401,7 +2345,7 @@ private constructor( } /** - * Returns an immutable instance of [DecrementLedgerEntry]. + * Returns an immutable instance of [Decrement]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2423,8 +2367,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): DecrementLedgerEntry = - DecrementLedgerEntry( + fun build(): Decrement = + Decrement( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -2447,7 +2391,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DecrementLedgerEntry = apply { + fun validate(): Decrement = apply { if (validated) { return@apply } @@ -3216,7 +3160,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Decrement && 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 */ @@ -3226,10 +3170,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Decrement{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}" } - class ExpirationChangeLedgerEntry + class ExpirationChange private constructor( private val id: JsonField, private val amount: JsonField, @@ -3525,8 +3469,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [ExpirationChangeLedgerEntry]. + * Returns a mutable builder for constructing an instance of [ExpirationChange]. * * The following fields are required: * ```java @@ -3548,7 +3491,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ExpirationChangeLedgerEntry]. */ + /** A builder for [ExpirationChange]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3568,23 +3511,22 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - id = expirationChangeLedgerEntry.id - amount = expirationChangeLedgerEntry.amount - createdAt = expirationChangeLedgerEntry.createdAt - 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() + internal fun from(expirationChange: ExpirationChange) = apply { + id = expirationChange.id + amount = expirationChange.amount + createdAt = expirationChange.createdAt + creditBlock = expirationChange.creditBlock + currency = expirationChange.currency + customer = expirationChange.customer + description = expirationChange.description + endingBalance = expirationChange.endingBalance + entryStatus = expirationChange.entryStatus + entryType = expirationChange.entryType + ledgerSequenceNumber = expirationChange.ledgerSequenceNumber + metadata = expirationChange.metadata + newBlockExpiryDate = expirationChange.newBlockExpiryDate + startingBalance = expirationChange.startingBalance + additionalProperties = expirationChange.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3798,7 +3740,7 @@ private constructor( } /** - * Returns an immutable instance of [ExpirationChangeLedgerEntry]. + * Returns an immutable instance of [ExpirationChange]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3821,8 +3763,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ExpirationChangeLedgerEntry = - ExpirationChangeLedgerEntry( + fun build(): ExpirationChange = + ExpirationChange( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -3843,7 +3785,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ExpirationChangeLedgerEntry = apply { + fun validate(): ExpirationChange = apply { if (validated) { return@apply } @@ -4608,7 +4550,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ExpirationChange && 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 */ @@ -4618,10 +4560,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ExpirationChange{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}" } - class CreditBlockExpiryLedgerEntry + class CreditBlockExpiry private constructor( private val id: JsonField, private val amount: JsonField, @@ -4895,8 +4837,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CreditBlockExpiryLedgerEntry]. + * Returns a mutable builder for constructing an instance of [CreditBlockExpiry]. * * The following fields are required: * ```java @@ -4917,7 +4858,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CreditBlockExpiryLedgerEntry]. */ + /** A builder for [CreditBlockExpiry]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4936,22 +4877,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - id = creditBlockExpiryLedgerEntry.id - amount = creditBlockExpiryLedgerEntry.amount - createdAt = creditBlockExpiryLedgerEntry.createdAt - 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() + internal fun from(creditBlockExpiry: CreditBlockExpiry) = apply { + id = creditBlockExpiry.id + amount = creditBlockExpiry.amount + createdAt = creditBlockExpiry.createdAt + creditBlock = creditBlockExpiry.creditBlock + currency = creditBlockExpiry.currency + customer = creditBlockExpiry.customer + description = creditBlockExpiry.description + endingBalance = creditBlockExpiry.endingBalance + entryStatus = creditBlockExpiry.entryStatus + entryType = creditBlockExpiry.entryType + ledgerSequenceNumber = creditBlockExpiry.ledgerSequenceNumber + metadata = creditBlockExpiry.metadata + startingBalance = creditBlockExpiry.startingBalance + additionalProperties = creditBlockExpiry.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -5144,7 +5084,7 @@ private constructor( } /** - * Returns an immutable instance of [CreditBlockExpiryLedgerEntry]. + * Returns an immutable instance of [CreditBlockExpiry]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5166,8 +5106,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): CreditBlockExpiryLedgerEntry = - CreditBlockExpiryLedgerEntry( + fun build(): CreditBlockExpiry = + CreditBlockExpiry( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -5187,7 +5127,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CreditBlockExpiryLedgerEntry = apply { + fun validate(): CreditBlockExpiry = apply { if (validated) { return@apply } @@ -5950,7 +5890,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is CreditBlockExpiry && 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 */ @@ -5960,10 +5900,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "CreditBlockExpiry{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}" } - class VoidLedgerEntry + class Void private constructor( private val id: JsonField, private val amount: JsonField, @@ -6277,7 +6217,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Void]. * * The following fields are required: * ```java @@ -6300,7 +6240,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidLedgerEntry]. */ + /** A builder for [Void]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -6321,23 +6261,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - id = voidLedgerEntry.id - amount = voidLedgerEntry.amount - createdAt = voidLedgerEntry.createdAt - creditBlock = voidLedgerEntry.creditBlock - currency = voidLedgerEntry.currency - customer = voidLedgerEntry.customer - description = voidLedgerEntry.description - endingBalance = voidLedgerEntry.endingBalance - entryStatus = voidLedgerEntry.entryStatus - entryType = voidLedgerEntry.entryType - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - metadata = voidLedgerEntry.metadata - startingBalance = voidLedgerEntry.startingBalance - voidAmount = voidLedgerEntry.voidAmount - voidReason = voidLedgerEntry.voidReason - additionalProperties = voidLedgerEntry.additionalProperties.toMutableMap() + internal fun from(void_: Void) = apply { + id = void_.id + amount = void_.amount + createdAt = void_.createdAt + creditBlock = void_.creditBlock + currency = void_.currency + customer = void_.customer + description = void_.description + endingBalance = void_.endingBalance + entryStatus = void_.entryStatus + entryType = void_.entryType + ledgerSequenceNumber = void_.ledgerSequenceNumber + metadata = void_.metadata + startingBalance = void_.startingBalance + voidAmount = void_.voidAmount + voidReason = void_.voidReason + additionalProperties = void_.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -6555,7 +6495,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidLedgerEntry]. + * Returns an immutable instance of [Void]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6579,8 +6519,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidLedgerEntry = - VoidLedgerEntry( + fun build(): Void = + Void( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -6602,7 +6542,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidLedgerEntry = apply { + fun validate(): Void = apply { if (validated) { return@apply } @@ -7369,7 +7309,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Void && 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 */ @@ -7379,10 +7319,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Void{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}" } - class VoidInitiatedLedgerEntry + class VoidInitiated private constructor( private val id: JsonField, private val amount: JsonField, @@ -7718,7 +7658,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidInitiatedLedgerEntry]. + * Returns a mutable builder for constructing an instance of [VoidInitiated]. * * The following fields are required: * ```java @@ -7742,7 +7682,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidInitiatedLedgerEntry]. */ + /** A builder for [VoidInitiated]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -7764,24 +7704,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - id = voidInitiatedLedgerEntry.id - amount = voidInitiatedLedgerEntry.amount - createdAt = voidInitiatedLedgerEntry.createdAt - 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 - startingBalance = voidInitiatedLedgerEntry.startingBalance - voidAmount = voidInitiatedLedgerEntry.voidAmount - voidReason = voidInitiatedLedgerEntry.voidReason - additionalProperties = voidInitiatedLedgerEntry.additionalProperties.toMutableMap() + internal fun from(voidInitiated: VoidInitiated) = apply { + id = voidInitiated.id + amount = voidInitiated.amount + createdAt = voidInitiated.createdAt + creditBlock = voidInitiated.creditBlock + currency = voidInitiated.currency + customer = voidInitiated.customer + description = voidInitiated.description + endingBalance = voidInitiated.endingBalance + entryStatus = voidInitiated.entryStatus + entryType = voidInitiated.entryType + ledgerSequenceNumber = voidInitiated.ledgerSequenceNumber + metadata = voidInitiated.metadata + newBlockExpiryDate = voidInitiated.newBlockExpiryDate + startingBalance = voidInitiated.startingBalance + voidAmount = voidInitiated.voidAmount + voidReason = voidInitiated.voidReason + additionalProperties = voidInitiated.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -8013,7 +7953,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidInitiatedLedgerEntry]. + * Returns an immutable instance of [VoidInitiated]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8038,8 +7978,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidInitiatedLedgerEntry = - VoidInitiatedLedgerEntry( + fun build(): VoidInitiated = + VoidInitiated( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -8062,7 +8002,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidInitiatedLedgerEntry = apply { + fun validate(): VoidInitiated = apply { if (validated) { return@apply } @@ -8831,7 +8771,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is VoidInitiated && 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 */ @@ -8841,10 +8781,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "VoidInitiated{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}" } - class AmendmentLedgerEntry + class Amendment private constructor( private val id: JsonField, private val amount: JsonField, @@ -9118,7 +9058,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [AmendmentLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Amendment]. * * The following fields are required: * ```java @@ -9139,7 +9079,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmendmentLedgerEntry]. */ + /** A builder for [Amendment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9158,21 +9098,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - id = amendmentLedgerEntry.id - amount = amendmentLedgerEntry.amount - createdAt = amendmentLedgerEntry.createdAt - 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() + internal fun from(amendment: Amendment) = apply { + id = amendment.id + amount = amendment.amount + createdAt = amendment.createdAt + creditBlock = amendment.creditBlock + currency = amendment.currency + customer = amendment.customer + description = amendment.description + endingBalance = amendment.endingBalance + entryStatus = amendment.entryStatus + entryType = amendment.entryType + ledgerSequenceNumber = amendment.ledgerSequenceNumber + metadata = amendment.metadata + startingBalance = amendment.startingBalance + additionalProperties = amendment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9365,7 +9305,7 @@ private constructor( } /** - * Returns an immutable instance of [AmendmentLedgerEntry]. + * Returns an immutable instance of [Amendment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9387,8 +9327,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmendmentLedgerEntry = - AmendmentLedgerEntry( + fun build(): Amendment = + Amendment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -9408,7 +9348,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmendmentLedgerEntry = apply { + fun validate(): Amendment = apply { if (validated) { return@apply } @@ -10171,7 +10111,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amendment && 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 */ @@ -10181,6 +10121,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Amendment{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 5c1d59aa4..876dcb8b5 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 @@ -194,94 +194,41 @@ private constructor( fun body(body: Body) = apply { this.body = body } - /** - * Alias for calling [body] with - * `Body.ofAddIncrementCreditLedgerEntryRequestParams(addIncrementCreditLedgerEntryRequestParams)`. - */ - fun body( - addIncrementCreditLedgerEntryRequestParams: - Body.AddIncrementCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofIncrement(increment)`. */ + fun body(increment: Body.Increment) = body(Body.ofIncrement(increment)) /** * Alias for calling [body] with the following: * ```java - * Body.AddIncrementCreditLedgerEntryRequestParams.builder() + * Body.Increment.builder() * .amount(amount) * .build() * ``` */ - fun addIncrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body(Body.AddIncrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) + fun incrementBody(amount: Double) = body(Body.Increment.builder().amount(amount).build()) - /** - * Alias for calling [body] with - * `Body.ofAddDecrementCreditLedgerEntryRequestParams(addDecrementCreditLedgerEntryRequestParams)`. - */ - fun body( - addDecrementCreditLedgerEntryRequestParams: - Body.AddDecrementCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofDecrement(decrement)`. */ + fun body(decrement: Body.Decrement) = body(Body.ofDecrement(decrement)) /** * Alias for calling [body] with the following: * ```java - * Body.AddDecrementCreditLedgerEntryRequestParams.builder() + * Body.Decrement.builder() * .amount(amount) * .build() * ``` */ - fun addDecrementCreditLedgerEntryRequestParamsBody(amount: Double) = - body(Body.AddDecrementCreditLedgerEntryRequestParams.builder().amount(amount).build()) + fun decrementBody(amount: Double) = body(Body.Decrement.builder().amount(amount).build()) - /** - * Alias for calling [body] with - * `Body.ofAddExpirationChangeCreditLedgerEntryRequestParams(addExpirationChangeCreditLedgerEntryRequestParams)`. - */ - fun body( - addExpirationChangeCreditLedgerEntryRequestParams: - Body.AddExpirationChangeCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofExpirationChange(expirationChange)`. */ + fun body(expirationChange: Body.ExpirationChange) = + body(Body.ofExpirationChange(expirationChange)) - /** - * Alias for calling [body] with - * `Body.ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams)`. - */ - fun body( - addVoidCreditLedgerEntryRequestParams: Body.AddVoidCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams) - ) + /** Alias for calling [body] with `Body.ofVoid(void_)`. */ + fun body(void_: Body.Void) = body(Body.ofVoid(void_)) - /** - * Alias for calling [body] with - * `Body.ofAddAmendmentCreditLedgerEntryRequestParams(addAmendmentCreditLedgerEntryRequestParams)`. - */ - fun body( - addAmendmentCreditLedgerEntryRequestParams: - Body.AddAmendmentCreditLedgerEntryRequestParams - ) = - body( - Body.ofAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams - ) - ) + /** Alias for calling [body] with `Body.ofAmendment(amendment)`. */ + fun body(amendment: Body.Amendment) = body(Body.ofAmendment(amendment)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -418,111 +365,53 @@ private constructor( @JsonSerialize(using = Body.Serializer::class) class Body private constructor( - private val addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams? = - null, - private val addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams? = - null, - private val addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams? = - null, - private val addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams? = - null, - private val addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams? = - null, + private val increment: Increment? = null, + private val decrement: Decrement? = null, + private val expirationChange: ExpirationChange? = null, + private val void_: Void? = null, + private val amendment: Amendment? = null, private val _json: JsonValue? = null, ) { - fun addIncrementCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addIncrementCreditLedgerEntryRequestParams) + fun increment(): Optional = Optional.ofNullable(increment) - fun addDecrementCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addDecrementCreditLedgerEntryRequestParams) + fun decrement(): Optional = Optional.ofNullable(decrement) - fun addExpirationChangeCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addExpirationChangeCreditLedgerEntryRequestParams) + fun expirationChange(): Optional = Optional.ofNullable(expirationChange) - fun addVoidCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addVoidCreditLedgerEntryRequestParams) + fun void_(): Optional = Optional.ofNullable(void_) - fun addAmendmentCreditLedgerEntryRequestParams(): - Optional = - Optional.ofNullable(addAmendmentCreditLedgerEntryRequestParams) + fun amendment(): Optional = Optional.ofNullable(amendment) - fun isAddIncrementCreditLedgerEntryRequestParams(): Boolean = - addIncrementCreditLedgerEntryRequestParams != null + fun isIncrement(): Boolean = increment != null - fun isAddDecrementCreditLedgerEntryRequestParams(): Boolean = - addDecrementCreditLedgerEntryRequestParams != null + fun isDecrement(): Boolean = decrement != null - fun isAddExpirationChangeCreditLedgerEntryRequestParams(): Boolean = - addExpirationChangeCreditLedgerEntryRequestParams != null + fun isExpirationChange(): Boolean = expirationChange != null - fun isAddVoidCreditLedgerEntryRequestParams(): Boolean = - addVoidCreditLedgerEntryRequestParams != null + fun isVoid(): Boolean = void_ != null - fun isAddAmendmentCreditLedgerEntryRequestParams(): Boolean = - addAmendmentCreditLedgerEntryRequestParams != null + fun isAmendment(): Boolean = amendment != null - fun asAddIncrementCreditLedgerEntryRequestParams(): - AddIncrementCreditLedgerEntryRequestParams = - addIncrementCreditLedgerEntryRequestParams.getOrThrow( - "addIncrementCreditLedgerEntryRequestParams" - ) + fun asIncrement(): Increment = increment.getOrThrow("increment") - fun asAddDecrementCreditLedgerEntryRequestParams(): - AddDecrementCreditLedgerEntryRequestParams = - addDecrementCreditLedgerEntryRequestParams.getOrThrow( - "addDecrementCreditLedgerEntryRequestParams" - ) + fun asDecrement(): Decrement = decrement.getOrThrow("decrement") - fun asAddExpirationChangeCreditLedgerEntryRequestParams(): - AddExpirationChangeCreditLedgerEntryRequestParams = - addExpirationChangeCreditLedgerEntryRequestParams.getOrThrow( - "addExpirationChangeCreditLedgerEntryRequestParams" - ) + fun asExpirationChange(): ExpirationChange = expirationChange.getOrThrow("expirationChange") - fun asAddVoidCreditLedgerEntryRequestParams(): AddVoidCreditLedgerEntryRequestParams = - addVoidCreditLedgerEntryRequestParams.getOrThrow( - "addVoidCreditLedgerEntryRequestParams" - ) + fun asVoid(): Void = void_.getOrThrow("void_") - fun asAddAmendmentCreditLedgerEntryRequestParams(): - AddAmendmentCreditLedgerEntryRequestParams = - addAmendmentCreditLedgerEntryRequestParams.getOrThrow( - "addAmendmentCreditLedgerEntryRequestParams" - ) + fun asAmendment(): Amendment = amendment.getOrThrow("amendment") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - addIncrementCreditLedgerEntryRequestParams != null -> - visitor.visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams - ) - addDecrementCreditLedgerEntryRequestParams != null -> - visitor.visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams - ) - addExpirationChangeCreditLedgerEntryRequestParams != null -> - visitor.visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams - ) - addVoidCreditLedgerEntryRequestParams != null -> - visitor.visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams - ) - addAmendmentCreditLedgerEntryRequestParams != null -> - visitor.visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams - ) + increment != null -> visitor.visitIncrement(increment) + decrement != null -> visitor.visitDecrement(decrement) + expirationChange != null -> visitor.visitExpirationChange(expirationChange) + void_ != null -> visitor.visitVoid(void_) + amendment != null -> visitor.visitAmendment(amendment) else -> visitor.unknown(_json) } @@ -535,38 +424,24 @@ private constructor( accept( object : Visitor { - override fun visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) { - addIncrementCreditLedgerEntryRequestParams.validate() + override fun visitIncrement(increment: Increment) { + increment.validate() } - override fun visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) { - addDecrementCreditLedgerEntryRequestParams.validate() + override fun visitDecrement(decrement: Decrement) { + decrement.validate() } - override fun visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) { - addExpirationChangeCreditLedgerEntryRequestParams.validate() + override fun visitExpirationChange(expirationChange: ExpirationChange) { + expirationChange.validate() } - override fun visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) { - addVoidCreditLedgerEntryRequestParams.validate() + override fun visitVoid(void_: Void) { + void_.validate() } - override fun visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) { - addAmendmentCreditLedgerEntryRequestParams.validate() + override fun visitAmendment(amendment: Amendment) { + amendment.validate() } } ) @@ -591,29 +466,16 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) = addIncrementCreditLedgerEntryRequestParams.validity() - - override fun visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) = addDecrementCreditLedgerEntryRequestParams.validity() - - override fun visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = addExpirationChangeCreditLedgerEntryRequestParams.validity() - - override fun visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = addVoidCreditLedgerEntryRequestParams.validity() - - override fun visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) = addAmendmentCreditLedgerEntryRequestParams.validity() + override fun visitIncrement(increment: Increment) = increment.validity() + + override fun visitDecrement(decrement: Decrement) = decrement.validity() + + override fun visitExpirationChange(expirationChange: ExpirationChange) = + expirationChange.validity() + + override fun visitVoid(void_: Void) = void_.validity() + + override fun visitAmendment(amendment: Amendment) = amendment.validity() override fun unknown(json: JsonValue?) = 0 } @@ -624,101 +486,49 @@ private constructor( return true } - return /* spotless:off */ other is Body && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */ + return /* spotless:off */ other is Body && increment == other.increment && decrement == other.decrement && expirationChange == other.expirationChange && void_ == other.void_ && amendment == other.amendment /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(increment, decrement, expirationChange, void_, amendment) /* spotless:on */ override fun toString(): String = when { - addIncrementCreditLedgerEntryRequestParams != null -> - "Body{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}" - addDecrementCreditLedgerEntryRequestParams != null -> - "Body{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}" - addExpirationChangeCreditLedgerEntryRequestParams != null -> - "Body{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}" - addVoidCreditLedgerEntryRequestParams != null -> - "Body{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}" - addAmendmentCreditLedgerEntryRequestParams != null -> - "Body{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}" + increment != null -> "Body{increment=$increment}" + decrement != null -> "Body{decrement=$decrement}" + expirationChange != null -> "Body{expirationChange=$expirationChange}" + void_ != null -> "Body{void_=$void_}" + amendment != null -> "Body{amendment=$amendment}" _json != null -> "Body{_unknown=$_json}" else -> throw IllegalStateException("Invalid Body") } companion object { - @JvmStatic - fun ofAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) = - Body( - addIncrementCreditLedgerEntryRequestParams = - addIncrementCreditLedgerEntryRequestParams - ) + @JvmStatic fun ofIncrement(increment: Increment) = Body(increment = increment) - @JvmStatic - fun ofAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) = - Body( - addDecrementCreditLedgerEntryRequestParams = - addDecrementCreditLedgerEntryRequestParams - ) + @JvmStatic fun ofDecrement(decrement: Decrement) = Body(decrement = decrement) @JvmStatic - fun ofAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = - Body( - addExpirationChangeCreditLedgerEntryRequestParams = - addExpirationChangeCreditLedgerEntryRequestParams - ) + fun ofExpirationChange(expirationChange: ExpirationChange) = + Body(expirationChange = expirationChange) - @JvmStatic - fun ofAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = Body(addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams) + @JvmStatic fun ofVoid(void_: Void) = Body(void_ = void_) - @JvmStatic - fun ofAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) = - Body( - addAmendmentCreditLedgerEntryRequestParams = - addAmendmentCreditLedgerEntryRequestParams - ) + @JvmStatic fun ofAmendment(amendment: Amendment) = Body(amendment = amendment) } /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { - fun visitAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ): T + fun visitIncrement(increment: Increment): T - fun visitAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ): T + fun visitDecrement(decrement: Decrement): T - fun visitAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ): T + fun visitExpirationChange(expirationChange: ExpirationChange): T - fun visitAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ): T + fun visitVoid(void_: Void): T - fun visitAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ): T + fun visitAmendment(amendment: Amendment): T /** * Maps an unknown variant of [Body] to a value of type [T]. @@ -743,51 +553,29 @@ private constructor( when (entryType) { "increment" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(addIncrementCreditLedgerEntryRequestParams = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(increment = it, _json = json) + } ?: Body(_json = json) } "decrement" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(addDecrementCreditLedgerEntryRequestParams = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(decrement = it, _json = json) + } ?: Body(_json = json) } "expiration_change" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body( - addExpirationChangeCreditLedgerEntryRequestParams = it, - _json = json, - ) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(expirationChange = it, _json = json) + } ?: Body(_json = json) } "void" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(addVoidCreditLedgerEntryRequestParams = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(void_ = it, _json = json) + } ?: Body(_json = json) } "amendment" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(addAmendmentCreditLedgerEntryRequestParams = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(amendment = it, _json = json) + } ?: Body(_json = json) } } @@ -803,25 +591,18 @@ private constructor( provider: SerializerProvider, ) { when { - value.addIncrementCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addIncrementCreditLedgerEntryRequestParams) - value.addDecrementCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addDecrementCreditLedgerEntryRequestParams) - value.addExpirationChangeCreditLedgerEntryRequestParams != null -> - generator.writeObject( - value.addExpirationChangeCreditLedgerEntryRequestParams - ) - value.addVoidCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addVoidCreditLedgerEntryRequestParams) - value.addAmendmentCreditLedgerEntryRequestParams != null -> - generator.writeObject(value.addAmendmentCreditLedgerEntryRequestParams) + value.increment != null -> generator.writeObject(value.increment) + value.decrement != null -> generator.writeObject(value.decrement) + value.expirationChange != null -> generator.writeObject(value.expirationChange) + value.void_ != null -> generator.writeObject(value.void_) + value.amendment != null -> generator.writeObject(value.amendment) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Body") } } } - class AddIncrementCreditLedgerEntryRequestParams + class Increment private constructor( private val amount: JsonField, private val entryType: JsonValue, @@ -1054,8 +835,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddIncrementCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Increment]. * * The following fields are required: * ```java @@ -1065,7 +845,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */ + /** A builder for [Increment]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -1080,22 +860,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams - ) = apply { - amount = addIncrementCreditLedgerEntryRequestParams.amount - entryType = addIncrementCreditLedgerEntryRequestParams.entryType - currency = addIncrementCreditLedgerEntryRequestParams.currency - description = addIncrementCreditLedgerEntryRequestParams.description - effectiveDate = addIncrementCreditLedgerEntryRequestParams.effectiveDate - expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate - invoiceSettings = addIncrementCreditLedgerEntryRequestParams.invoiceSettings - metadata = addIncrementCreditLedgerEntryRequestParams.metadata - perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis - additionalProperties = - addIncrementCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(increment: Increment) = apply { + amount = increment.amount + entryType = increment.entryType + currency = increment.currency + description = increment.description + effectiveDate = increment.effectiveDate + expiryDate = increment.expiryDate + invoiceSettings = increment.invoiceSettings + metadata = increment.metadata + perUnitCostBasis = increment.perUnitCostBasis + additionalProperties = increment.additionalProperties.toMutableMap() } /** @@ -1301,7 +1076,7 @@ private constructor( } /** - * Returns an immutable instance of [AddIncrementCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Increment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -1312,8 +1087,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddIncrementCreditLedgerEntryRequestParams = - AddIncrementCreditLedgerEntryRequestParams( + fun build(): Increment = + Increment( checkRequired("amount", amount), entryType, currency, @@ -1329,7 +1104,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply { + fun validate(): Increment = apply { if (validated) { return@apply } @@ -1809,7 +1584,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Increment && 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 */ @@ -1819,10 +1594,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" + "Increment{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" } - class AddDecrementCreditLedgerEntryRequestParams + class Decrement private constructor( private val amount: JsonField, private val entryType: JsonValue, @@ -1949,8 +1724,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddDecrementCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Decrement]. * * The following fields are required: * ```java @@ -1960,7 +1734,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddDecrementCreditLedgerEntryRequestParams]. */ + /** A builder for [Decrement]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -1971,18 +1745,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams - ) = apply { - amount = addDecrementCreditLedgerEntryRequestParams.amount - entryType = addDecrementCreditLedgerEntryRequestParams.entryType - currency = addDecrementCreditLedgerEntryRequestParams.currency - description = addDecrementCreditLedgerEntryRequestParams.description - metadata = addDecrementCreditLedgerEntryRequestParams.metadata - additionalProperties = - addDecrementCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(decrement: Decrement) = apply { + amount = decrement.amount + entryType = decrement.entryType + currency = decrement.currency + description = decrement.description + metadata = decrement.metadata + additionalProperties = decrement.additionalProperties.toMutableMap() } /** @@ -2097,7 +1866,7 @@ private constructor( } /** - * Returns an immutable instance of [AddDecrementCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Decrement]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2108,8 +1877,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddDecrementCreditLedgerEntryRequestParams = - AddDecrementCreditLedgerEntryRequestParams( + fun build(): Decrement = + Decrement( checkRequired("amount", amount), entryType, currency, @@ -2121,7 +1890,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddDecrementCreditLedgerEntryRequestParams = apply { + fun validate(): Decrement = apply { if (validated) { return@apply } @@ -2276,7 +2045,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Decrement && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2286,10 +2055,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "Decrement{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } - class AddExpirationChangeCreditLedgerEntryRequestParams + class ExpirationChange private constructor( private val entryType: JsonValue, private val expiryDate: JsonField, @@ -2491,8 +2260,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddExpirationChangeCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [ExpirationChange]. * * The following fields are required: * ```java @@ -2503,7 +2271,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ + /** A builder for [ExpirationChange]. */ class Builder internal constructor() { private var entryType: JsonValue = JsonValue.from("expiration_change") @@ -2517,22 +2285,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = apply { - entryType = addExpirationChangeCreditLedgerEntryRequestParams.entryType - expiryDate = addExpirationChangeCreditLedgerEntryRequestParams.expiryDate - targetExpiryDate = - addExpirationChangeCreditLedgerEntryRequestParams.targetExpiryDate - amount = addExpirationChangeCreditLedgerEntryRequestParams.amount - blockId = addExpirationChangeCreditLedgerEntryRequestParams.blockId - currency = addExpirationChangeCreditLedgerEntryRequestParams.currency - description = addExpirationChangeCreditLedgerEntryRequestParams.description - metadata = addExpirationChangeCreditLedgerEntryRequestParams.metadata - additionalProperties = - addExpirationChangeCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(expirationChange: ExpirationChange) = apply { + entryType = expirationChange.entryType + expiryDate = expirationChange.expiryDate + targetExpiryDate = expirationChange.targetExpiryDate + amount = expirationChange.amount + blockId = expirationChange.blockId + currency = expirationChange.currency + description = expirationChange.description + metadata = expirationChange.metadata + additionalProperties = expirationChange.additionalProperties.toMutableMap() } /** @@ -2715,8 +2477,7 @@ private constructor( } /** - * Returns an immutable instance of - * [AddExpirationChangeCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [ExpirationChange]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2728,8 +2489,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = - AddExpirationChangeCreditLedgerEntryRequestParams( + fun build(): ExpirationChange = + ExpirationChange( entryType, checkRequired("expiryDate", expiryDate), checkRequired("targetExpiryDate", targetExpiryDate), @@ -2744,7 +2505,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddExpirationChangeCreditLedgerEntryRequestParams = apply { + fun validate(): ExpirationChange = apply { if (validated) { return@apply } @@ -2905,7 +2666,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ExpirationChange && 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 */ @@ -2915,10 +2676,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "ExpirationChange{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } - class AddVoidCreditLedgerEntryRequestParams + class Void private constructor( private val amount: JsonField, private val blockId: JsonField, @@ -3096,8 +2857,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddVoidCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Void]. * * The following fields are required: * ```java @@ -3108,7 +2868,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddVoidCreditLedgerEntryRequestParams]. */ + /** A builder for [Void]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -3121,18 +2881,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = apply { - amount = addVoidCreditLedgerEntryRequestParams.amount - blockId = addVoidCreditLedgerEntryRequestParams.blockId - entryType = addVoidCreditLedgerEntryRequestParams.entryType - currency = addVoidCreditLedgerEntryRequestParams.currency - description = addVoidCreditLedgerEntryRequestParams.description - metadata = addVoidCreditLedgerEntryRequestParams.metadata - voidReason = addVoidCreditLedgerEntryRequestParams.voidReason - additionalProperties = - addVoidCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() + internal fun from(void_: Void) = apply { + amount = void_.amount + blockId = void_.blockId + entryType = void_.entryType + currency = void_.currency + description = void_.description + metadata = void_.metadata + voidReason = void_.voidReason + additionalProperties = void_.additionalProperties.toMutableMap() } /** @@ -3278,7 +3035,7 @@ private constructor( } /** - * Returns an immutable instance of [AddVoidCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Void]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3290,8 +3047,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddVoidCreditLedgerEntryRequestParams = - AddVoidCreditLedgerEntryRequestParams( + fun build(): Void = + Void( checkRequired("amount", amount), checkRequired("blockId", blockId), entryType, @@ -3305,7 +3062,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddVoidCreditLedgerEntryRequestParams = apply { + fun validate(): Void = apply { if (validated) { return@apply } @@ -3591,7 +3348,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Void && 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 */ @@ -3601,10 +3358,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" + "Void{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" } - class AddAmendmentCreditLedgerEntryRequestParams + class Amendment private constructor( private val amount: JsonField, private val blockId: JsonField, @@ -3751,8 +3508,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AddAmendmentCreditLedgerEntryRequestParams]. + * Returns a mutable builder for constructing an instance of [Amendment]. * * The following fields are required: * ```java @@ -3763,7 +3519,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AddAmendmentCreditLedgerEntryRequestParams]. */ + /** A builder for [Amendment]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -3775,19 +3531,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams - ) = apply { - amount = addAmendmentCreditLedgerEntryRequestParams.amount - blockId = addAmendmentCreditLedgerEntryRequestParams.blockId - entryType = addAmendmentCreditLedgerEntryRequestParams.entryType - currency = addAmendmentCreditLedgerEntryRequestParams.currency - description = addAmendmentCreditLedgerEntryRequestParams.description - metadata = addAmendmentCreditLedgerEntryRequestParams.metadata - additionalProperties = - addAmendmentCreditLedgerEntryRequestParams.additionalProperties - .toMutableMap() + internal fun from(amendment: Amendment) = apply { + amount = amendment.amount + blockId = amendment.blockId + entryType = amendment.entryType + currency = amendment.currency + description = amendment.description + metadata = amendment.metadata + additionalProperties = amendment.additionalProperties.toMutableMap() } /** @@ -3914,7 +3665,7 @@ private constructor( } /** - * Returns an immutable instance of [AddAmendmentCreditLedgerEntryRequestParams]. + * Returns an immutable instance of [Amendment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3926,8 +3677,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AddAmendmentCreditLedgerEntryRequestParams = - AddAmendmentCreditLedgerEntryRequestParams( + fun build(): Amendment = + Amendment( checkRequired("amount", amount), checkRequired("blockId", blockId), entryType, @@ -3940,7 +3691,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AddAmendmentCreditLedgerEntryRequestParams = apply { + fun validate(): Amendment = apply { if (validated) { return@apply } @@ -4097,7 +3848,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amendment && 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 */ @@ -4107,7 +3858,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "Amendment{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } } 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 e722d0352..fa95ecc91 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 @@ -38,84 +38,69 @@ import kotlin.jvm.optionals.getOrNull @JsonSerialize(using = CustomerCreditLedgerCreateEntryResponse.Serializer::class) class CustomerCreditLedgerCreateEntryResponse private constructor( - private val incrementLedgerEntry: IncrementLedgerEntry? = null, - private val decrementLedgerEntry: DecrementLedgerEntry? = null, - private val expirationChangeLedgerEntry: ExpirationChangeLedgerEntry? = null, - private val creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry? = null, - private val voidLedgerEntry: VoidLedgerEntry? = null, - private val voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry? = null, - private val amendmentLedgerEntry: AmendmentLedgerEntry? = null, + private val increment: Increment? = null, + private val decrement: Decrement? = null, + private val expirationChange: ExpirationChange? = null, + private val creditBlockExpiry: CreditBlockExpiry? = null, + private val void_: Void? = null, + private val voidInitiated: VoidInitiated? = null, + private val amendment: Amendment? = null, private val _json: JsonValue? = null, ) { - fun incrementLedgerEntry(): Optional = - Optional.ofNullable(incrementLedgerEntry) + fun increment(): Optional = Optional.ofNullable(increment) - fun decrementLedgerEntry(): Optional = - Optional.ofNullable(decrementLedgerEntry) + fun decrement(): Optional = Optional.ofNullable(decrement) - fun expirationChangeLedgerEntry(): Optional = - Optional.ofNullable(expirationChangeLedgerEntry) + fun expirationChange(): Optional = Optional.ofNullable(expirationChange) - fun creditBlockExpiryLedgerEntry(): Optional = - Optional.ofNullable(creditBlockExpiryLedgerEntry) + fun creditBlockExpiry(): Optional = Optional.ofNullable(creditBlockExpiry) - fun voidLedgerEntry(): Optional = Optional.ofNullable(voidLedgerEntry) + fun void_(): Optional = Optional.ofNullable(void_) - fun voidInitiatedLedgerEntry(): Optional = - Optional.ofNullable(voidInitiatedLedgerEntry) + fun voidInitiated(): Optional = Optional.ofNullable(voidInitiated) - fun amendmentLedgerEntry(): Optional = - Optional.ofNullable(amendmentLedgerEntry) + fun amendment(): Optional = Optional.ofNullable(amendment) - fun isIncrementLedgerEntry(): Boolean = incrementLedgerEntry != null + fun isIncrement(): Boolean = increment != null - fun isDecrementLedgerEntry(): Boolean = decrementLedgerEntry != null + fun isDecrement(): Boolean = decrement != null - fun isExpirationChangeLedgerEntry(): Boolean = expirationChangeLedgerEntry != null + fun isExpirationChange(): Boolean = expirationChange != null - fun isCreditBlockExpiryLedgerEntry(): Boolean = creditBlockExpiryLedgerEntry != null + fun isCreditBlockExpiry(): Boolean = creditBlockExpiry != null - fun isVoidLedgerEntry(): Boolean = voidLedgerEntry != null + fun isVoid(): Boolean = void_ != null - fun isVoidInitiatedLedgerEntry(): Boolean = voidInitiatedLedgerEntry != null + fun isVoidInitiated(): Boolean = voidInitiated != null - fun isAmendmentLedgerEntry(): Boolean = amendmentLedgerEntry != null + fun isAmendment(): Boolean = amendment != null - fun asIncrementLedgerEntry(): IncrementLedgerEntry = - incrementLedgerEntry.getOrThrow("incrementLedgerEntry") + fun asIncrement(): Increment = increment.getOrThrow("increment") - fun asDecrementLedgerEntry(): DecrementLedgerEntry = - decrementLedgerEntry.getOrThrow("decrementLedgerEntry") + fun asDecrement(): Decrement = decrement.getOrThrow("decrement") - fun asExpirationChangeLedgerEntry(): ExpirationChangeLedgerEntry = - expirationChangeLedgerEntry.getOrThrow("expirationChangeLedgerEntry") + fun asExpirationChange(): ExpirationChange = expirationChange.getOrThrow("expirationChange") - fun asCreditBlockExpiryLedgerEntry(): CreditBlockExpiryLedgerEntry = - creditBlockExpiryLedgerEntry.getOrThrow("creditBlockExpiryLedgerEntry") + fun asCreditBlockExpiry(): CreditBlockExpiry = creditBlockExpiry.getOrThrow("creditBlockExpiry") - fun asVoidLedgerEntry(): VoidLedgerEntry = voidLedgerEntry.getOrThrow("voidLedgerEntry") + fun asVoid(): Void = void_.getOrThrow("void_") - fun asVoidInitiatedLedgerEntry(): VoidInitiatedLedgerEntry = - voidInitiatedLedgerEntry.getOrThrow("voidInitiatedLedgerEntry") + fun asVoidInitiated(): VoidInitiated = voidInitiated.getOrThrow("voidInitiated") - fun asAmendmentLedgerEntry(): AmendmentLedgerEntry = - amendmentLedgerEntry.getOrThrow("amendmentLedgerEntry") + fun asAmendment(): Amendment = amendment.getOrThrow("amendment") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry) - decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry) - expirationChangeLedgerEntry != null -> - visitor.visitExpirationChangeLedgerEntry(expirationChangeLedgerEntry) - creditBlockExpiryLedgerEntry != null -> - visitor.visitCreditBlockExpiryLedgerEntry(creditBlockExpiryLedgerEntry) - voidLedgerEntry != null -> visitor.visitVoidLedgerEntry(voidLedgerEntry) - voidInitiatedLedgerEntry != null -> - visitor.visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry) - amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry) + increment != null -> visitor.visitIncrement(increment) + decrement != null -> visitor.visitDecrement(decrement) + expirationChange != null -> visitor.visitExpirationChange(expirationChange) + creditBlockExpiry != null -> visitor.visitCreditBlockExpiry(creditBlockExpiry) + void_ != null -> visitor.visitVoid(void_) + voidInitiated != null -> visitor.visitVoidInitiated(voidInitiated) + amendment != null -> visitor.visitAmendment(amendment) else -> visitor.unknown(_json) } @@ -128,38 +113,32 @@ private constructor( accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) { - incrementLedgerEntry.validate() + override fun visitIncrement(increment: Increment) { + increment.validate() } - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) { - decrementLedgerEntry.validate() + override fun visitDecrement(decrement: Decrement) { + decrement.validate() } - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) { - expirationChangeLedgerEntry.validate() + override fun visitExpirationChange(expirationChange: ExpirationChange) { + expirationChange.validate() } - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) { - creditBlockExpiryLedgerEntry.validate() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) { + creditBlockExpiry.validate() } - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) { - voidLedgerEntry.validate() + override fun visitVoid(void_: Void) { + void_.validate() } - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) { - voidInitiatedLedgerEntry.validate() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) { + voidInitiated.validate() } - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) { - amendmentLedgerEntry.validate() + override fun visitAmendment(amendment: Amendment) { + amendment.validate() } } ) @@ -183,29 +162,22 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - incrementLedgerEntry.validity() + override fun visitIncrement(increment: Increment) = increment.validity() - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - decrementLedgerEntry.validity() + override fun visitDecrement(decrement: Decrement) = decrement.validity() - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = expirationChangeLedgerEntry.validity() + override fun visitExpirationChange(expirationChange: ExpirationChange) = + expirationChange.validity() - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = creditBlockExpiryLedgerEntry.validity() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + creditBlockExpiry.validity() - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - voidLedgerEntry.validity() + override fun visitVoid(void_: Void) = void_.validity() - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) = voidInitiatedLedgerEntry.validity() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) = + voidInitiated.validity() - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - amendmentLedgerEntry.validity() + override fun visitAmendment(amendment: Amendment) = amendment.validity() override fun unknown(json: JsonValue?) = 0 } @@ -216,27 +188,23 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryResponse && incrementLedgerEntry == other.incrementLedgerEntry && decrementLedgerEntry == other.decrementLedgerEntry && expirationChangeLedgerEntry == other.expirationChangeLedgerEntry && creditBlockExpiryLedgerEntry == other.creditBlockExpiryLedgerEntry && voidLedgerEntry == other.voidLedgerEntry && voidInitiatedLedgerEntry == other.voidInitiatedLedgerEntry && amendmentLedgerEntry == other.amendmentLedgerEntry /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerCreateEntryResponse && increment == other.increment && decrement == other.decrement && expirationChange == other.expirationChange && creditBlockExpiry == other.creditBlockExpiry && void_ == other.void_ && voidInitiated == other.voidInitiated && amendment == other.amendment /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(incrementLedgerEntry, decrementLedgerEntry, expirationChangeLedgerEntry, creditBlockExpiryLedgerEntry, voidLedgerEntry, voidInitiatedLedgerEntry, amendmentLedgerEntry) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(increment, decrement, expirationChange, creditBlockExpiry, void_, voidInitiated, amendment) /* spotless:on */ override fun toString(): String = when { - incrementLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{incrementLedgerEntry=$incrementLedgerEntry}" - decrementLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{decrementLedgerEntry=$decrementLedgerEntry}" - expirationChangeLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{expirationChangeLedgerEntry=$expirationChangeLedgerEntry}" - creditBlockExpiryLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{creditBlockExpiryLedgerEntry=$creditBlockExpiryLedgerEntry}" - voidLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{voidLedgerEntry=$voidLedgerEntry}" - voidInitiatedLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{voidInitiatedLedgerEntry=$voidInitiatedLedgerEntry}" - amendmentLedgerEntry != null -> - "CustomerCreditLedgerCreateEntryResponse{amendmentLedgerEntry=$amendmentLedgerEntry}" + increment != null -> "CustomerCreditLedgerCreateEntryResponse{increment=$increment}" + decrement != null -> "CustomerCreditLedgerCreateEntryResponse{decrement=$decrement}" + expirationChange != null -> + "CustomerCreditLedgerCreateEntryResponse{expirationChange=$expirationChange}" + creditBlockExpiry != null -> + "CustomerCreditLedgerCreateEntryResponse{creditBlockExpiry=$creditBlockExpiry}" + void_ != null -> "CustomerCreditLedgerCreateEntryResponse{void_=$void_}" + voidInitiated != null -> + "CustomerCreditLedgerCreateEntryResponse{voidInitiated=$voidInitiated}" + amendment != null -> "CustomerCreditLedgerCreateEntryResponse{amendment=$amendment}" _json != null -> "CustomerCreditLedgerCreateEntryResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid CustomerCreditLedgerCreateEntryResponse") } @@ -244,42 +212,30 @@ private constructor( companion object { @JvmStatic - fun ofIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - CustomerCreditLedgerCreateEntryResponse(incrementLedgerEntry = incrementLedgerEntry) + fun ofIncrement(increment: Increment) = + CustomerCreditLedgerCreateEntryResponse(increment = increment) @JvmStatic - fun ofDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - CustomerCreditLedgerCreateEntryResponse(decrementLedgerEntry = decrementLedgerEntry) + fun ofDecrement(decrement: Decrement) = + CustomerCreditLedgerCreateEntryResponse(decrement = decrement) @JvmStatic - fun ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = - CustomerCreditLedgerCreateEntryResponse( - expirationChangeLedgerEntry = expirationChangeLedgerEntry - ) + fun ofExpirationChange(expirationChange: ExpirationChange) = + CustomerCreditLedgerCreateEntryResponse(expirationChange = expirationChange) @JvmStatic - fun ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = - CustomerCreditLedgerCreateEntryResponse( - creditBlockExpiryLedgerEntry = creditBlockExpiryLedgerEntry - ) + fun ofCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + CustomerCreditLedgerCreateEntryResponse(creditBlockExpiry = creditBlockExpiry) - @JvmStatic - fun ofVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - CustomerCreditLedgerCreateEntryResponse(voidLedgerEntry = voidLedgerEntry) + @JvmStatic fun ofVoid(void_: Void) = CustomerCreditLedgerCreateEntryResponse(void_ = void_) @JvmStatic - fun ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = - CustomerCreditLedgerCreateEntryResponse( - voidInitiatedLedgerEntry = voidInitiatedLedgerEntry - ) + fun ofVoidInitiated(voidInitiated: VoidInitiated) = + CustomerCreditLedgerCreateEntryResponse(voidInitiated = voidInitiated) @JvmStatic - fun ofAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - CustomerCreditLedgerCreateEntryResponse(amendmentLedgerEntry = amendmentLedgerEntry) + fun ofAmendment(amendment: Amendment) = + CustomerCreditLedgerCreateEntryResponse(amendment = amendment) } /** @@ -288,23 +244,19 @@ private constructor( */ interface Visitor { - fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry): T + fun visitIncrement(increment: Increment): T - fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry): T + fun visitDecrement(decrement: Decrement): T - fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ): T + fun visitExpirationChange(expirationChange: ExpirationChange): T - fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ): T + fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry): T - fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry): T + fun visitVoid(void_: Void): T - fun visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry): T + fun visitVoidInitiated(voidInitiated: VoidInitiated): T - fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry): T + fun visitAmendment(amendment: Amendment): T /** * Maps an unknown variant of [CustomerCreditLedgerCreateEntryResponse] to a value of type @@ -335,58 +287,41 @@ private constructor( when (entryType) { "increment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerCreateEntryResponse( - incrementLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse(increment = it, _json = json) } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } "decrement" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerCreateEntryResponse( - decrementLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse(decrement = it, _json = json) } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } "expiration_change" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerCreateEntryResponse( - expirationChangeLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse(expirationChange = it, _json = json) + } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } "credit_block_expiry" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerCreateEntryResponse( - creditBlockExpiryLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse( + creditBlockExpiry = it, + _json = json, + ) + } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } "void" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerCreateEntryResponse(voidLedgerEntry = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse(void_ = it, _json = json) } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } "void_initiated" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerCreateEntryResponse( - voidInitiatedLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse(voidInitiated = it, _json = json) } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } "amendment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerCreateEntryResponse( - amendmentLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerCreateEntryResponse(amendment = it, _json = json) } ?: CustomerCreditLedgerCreateEntryResponse(_json = json) } } @@ -406,19 +341,13 @@ private constructor( provider: SerializerProvider, ) { when { - value.incrementLedgerEntry != null -> - generator.writeObject(value.incrementLedgerEntry) - value.decrementLedgerEntry != null -> - generator.writeObject(value.decrementLedgerEntry) - value.expirationChangeLedgerEntry != null -> - generator.writeObject(value.expirationChangeLedgerEntry) - value.creditBlockExpiryLedgerEntry != null -> - generator.writeObject(value.creditBlockExpiryLedgerEntry) - value.voidLedgerEntry != null -> generator.writeObject(value.voidLedgerEntry) - value.voidInitiatedLedgerEntry != null -> - generator.writeObject(value.voidInitiatedLedgerEntry) - value.amendmentLedgerEntry != null -> - generator.writeObject(value.amendmentLedgerEntry) + value.increment != null -> generator.writeObject(value.increment) + value.decrement != null -> generator.writeObject(value.decrement) + value.expirationChange != null -> generator.writeObject(value.expirationChange) + value.creditBlockExpiry != null -> generator.writeObject(value.creditBlockExpiry) + value.void_ != null -> generator.writeObject(value.void_) + value.voidInitiated != null -> generator.writeObject(value.voidInitiated) + value.amendment != null -> generator.writeObject(value.amendment) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid CustomerCreditLedgerCreateEntryResponse") @@ -426,7 +355,7 @@ private constructor( } } - class IncrementLedgerEntry + class Increment private constructor( private val id: JsonField, private val amount: JsonField, @@ -700,7 +629,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [IncrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Increment]. * * The following fields are required: * ```java @@ -721,7 +650,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [IncrementLedgerEntry]. */ + /** A builder for [Increment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -740,21 +669,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - id = incrementLedgerEntry.id - amount = incrementLedgerEntry.amount - createdAt = incrementLedgerEntry.createdAt - 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() + internal fun from(increment: Increment) = apply { + id = increment.id + amount = increment.amount + createdAt = increment.createdAt + creditBlock = increment.creditBlock + currency = increment.currency + customer = increment.customer + description = increment.description + endingBalance = increment.endingBalance + entryStatus = increment.entryStatus + entryType = increment.entryType + ledgerSequenceNumber = increment.ledgerSequenceNumber + metadata = increment.metadata + startingBalance = increment.startingBalance + additionalProperties = increment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -947,7 +876,7 @@ private constructor( } /** - * Returns an immutable instance of [IncrementLedgerEntry]. + * Returns an immutable instance of [Increment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -969,8 +898,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): IncrementLedgerEntry = - IncrementLedgerEntry( + fun build(): Increment = + Increment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -990,7 +919,7 @@ private constructor( private var validated: Boolean = false - fun validate(): IncrementLedgerEntry = apply { + fun validate(): Increment = apply { if (validated) { return@apply } @@ -1753,7 +1682,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Increment && 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 */ @@ -1763,10 +1692,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Increment{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}" } - class DecrementLedgerEntry + class Decrement private constructor( private val id: JsonField, private val amount: JsonField, @@ -2090,7 +2019,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [DecrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Decrement]. * * The following fields are required: * ```java @@ -2111,7 +2040,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DecrementLedgerEntry]. */ + /** A builder for [Decrement]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2133,24 +2062,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - id = decrementLedgerEntry.id - amount = decrementLedgerEntry.amount - createdAt = decrementLedgerEntry.createdAt - creditBlock = decrementLedgerEntry.creditBlock - currency = decrementLedgerEntry.currency - customer = decrementLedgerEntry.customer - description = decrementLedgerEntry.description - endingBalance = decrementLedgerEntry.endingBalance - entryStatus = decrementLedgerEntry.entryStatus - entryType = decrementLedgerEntry.entryType - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - metadata = decrementLedgerEntry.metadata - startingBalance = decrementLedgerEntry.startingBalance - eventId = decrementLedgerEntry.eventId - invoiceId = decrementLedgerEntry.invoiceId - priceId = decrementLedgerEntry.priceId - additionalProperties = decrementLedgerEntry.additionalProperties.toMutableMap() + internal fun from(decrement: Decrement) = apply { + id = decrement.id + amount = decrement.amount + createdAt = decrement.createdAt + creditBlock = decrement.creditBlock + currency = decrement.currency + customer = decrement.customer + description = decrement.description + endingBalance = decrement.endingBalance + entryStatus = decrement.entryStatus + entryType = decrement.entryType + ledgerSequenceNumber = decrement.ledgerSequenceNumber + metadata = decrement.metadata + startingBalance = decrement.startingBalance + eventId = decrement.eventId + invoiceId = decrement.invoiceId + priceId = decrement.priceId + additionalProperties = decrement.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2385,7 +2314,7 @@ private constructor( } /** - * Returns an immutable instance of [DecrementLedgerEntry]. + * Returns an immutable instance of [Decrement]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2407,8 +2336,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): DecrementLedgerEntry = - DecrementLedgerEntry( + fun build(): Decrement = + Decrement( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -2431,7 +2360,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DecrementLedgerEntry = apply { + fun validate(): Decrement = apply { if (validated) { return@apply } @@ -3200,7 +3129,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Decrement && 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 */ @@ -3210,10 +3139,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Decrement{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}" } - class ExpirationChangeLedgerEntry + class ExpirationChange private constructor( private val id: JsonField, private val amount: JsonField, @@ -3509,8 +3438,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [ExpirationChangeLedgerEntry]. + * Returns a mutable builder for constructing an instance of [ExpirationChange]. * * The following fields are required: * ```java @@ -3532,7 +3460,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ExpirationChangeLedgerEntry]. */ + /** A builder for [ExpirationChange]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3552,23 +3480,22 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - id = expirationChangeLedgerEntry.id - amount = expirationChangeLedgerEntry.amount - createdAt = expirationChangeLedgerEntry.createdAt - 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() + internal fun from(expirationChange: ExpirationChange) = apply { + id = expirationChange.id + amount = expirationChange.amount + createdAt = expirationChange.createdAt + creditBlock = expirationChange.creditBlock + currency = expirationChange.currency + customer = expirationChange.customer + description = expirationChange.description + endingBalance = expirationChange.endingBalance + entryStatus = expirationChange.entryStatus + entryType = expirationChange.entryType + ledgerSequenceNumber = expirationChange.ledgerSequenceNumber + metadata = expirationChange.metadata + newBlockExpiryDate = expirationChange.newBlockExpiryDate + startingBalance = expirationChange.startingBalance + additionalProperties = expirationChange.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3782,7 +3709,7 @@ private constructor( } /** - * Returns an immutable instance of [ExpirationChangeLedgerEntry]. + * Returns an immutable instance of [ExpirationChange]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3805,8 +3732,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ExpirationChangeLedgerEntry = - ExpirationChangeLedgerEntry( + fun build(): ExpirationChange = + ExpirationChange( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -3827,7 +3754,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ExpirationChangeLedgerEntry = apply { + fun validate(): ExpirationChange = apply { if (validated) { return@apply } @@ -4592,7 +4519,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ExpirationChange && 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 */ @@ -4602,10 +4529,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ExpirationChange{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}" } - class CreditBlockExpiryLedgerEntry + class CreditBlockExpiry private constructor( private val id: JsonField, private val amount: JsonField, @@ -4879,8 +4806,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CreditBlockExpiryLedgerEntry]. + * Returns a mutable builder for constructing an instance of [CreditBlockExpiry]. * * The following fields are required: * ```java @@ -4901,7 +4827,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CreditBlockExpiryLedgerEntry]. */ + /** A builder for [CreditBlockExpiry]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4920,22 +4846,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - id = creditBlockExpiryLedgerEntry.id - amount = creditBlockExpiryLedgerEntry.amount - createdAt = creditBlockExpiryLedgerEntry.createdAt - 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() + internal fun from(creditBlockExpiry: CreditBlockExpiry) = apply { + id = creditBlockExpiry.id + amount = creditBlockExpiry.amount + createdAt = creditBlockExpiry.createdAt + creditBlock = creditBlockExpiry.creditBlock + currency = creditBlockExpiry.currency + customer = creditBlockExpiry.customer + description = creditBlockExpiry.description + endingBalance = creditBlockExpiry.endingBalance + entryStatus = creditBlockExpiry.entryStatus + entryType = creditBlockExpiry.entryType + ledgerSequenceNumber = creditBlockExpiry.ledgerSequenceNumber + metadata = creditBlockExpiry.metadata + startingBalance = creditBlockExpiry.startingBalance + additionalProperties = creditBlockExpiry.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -5128,7 +5053,7 @@ private constructor( } /** - * Returns an immutable instance of [CreditBlockExpiryLedgerEntry]. + * Returns an immutable instance of [CreditBlockExpiry]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5150,8 +5075,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): CreditBlockExpiryLedgerEntry = - CreditBlockExpiryLedgerEntry( + fun build(): CreditBlockExpiry = + CreditBlockExpiry( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -5171,7 +5096,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CreditBlockExpiryLedgerEntry = apply { + fun validate(): CreditBlockExpiry = apply { if (validated) { return@apply } @@ -5934,7 +5859,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is CreditBlockExpiry && 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 */ @@ -5944,10 +5869,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "CreditBlockExpiry{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}" } - class VoidLedgerEntry + class Void private constructor( private val id: JsonField, private val amount: JsonField, @@ -6261,7 +6186,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Void]. * * The following fields are required: * ```java @@ -6284,7 +6209,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidLedgerEntry]. */ + /** A builder for [Void]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -6305,23 +6230,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - id = voidLedgerEntry.id - amount = voidLedgerEntry.amount - createdAt = voidLedgerEntry.createdAt - creditBlock = voidLedgerEntry.creditBlock - currency = voidLedgerEntry.currency - customer = voidLedgerEntry.customer - description = voidLedgerEntry.description - endingBalance = voidLedgerEntry.endingBalance - entryStatus = voidLedgerEntry.entryStatus - entryType = voidLedgerEntry.entryType - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - metadata = voidLedgerEntry.metadata - startingBalance = voidLedgerEntry.startingBalance - voidAmount = voidLedgerEntry.voidAmount - voidReason = voidLedgerEntry.voidReason - additionalProperties = voidLedgerEntry.additionalProperties.toMutableMap() + internal fun from(void_: Void) = apply { + id = void_.id + amount = void_.amount + createdAt = void_.createdAt + creditBlock = void_.creditBlock + currency = void_.currency + customer = void_.customer + description = void_.description + endingBalance = void_.endingBalance + entryStatus = void_.entryStatus + entryType = void_.entryType + ledgerSequenceNumber = void_.ledgerSequenceNumber + metadata = void_.metadata + startingBalance = void_.startingBalance + voidAmount = void_.voidAmount + voidReason = void_.voidReason + additionalProperties = void_.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -6539,7 +6464,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidLedgerEntry]. + * Returns an immutable instance of [Void]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6563,8 +6488,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidLedgerEntry = - VoidLedgerEntry( + fun build(): Void = + Void( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -6586,7 +6511,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidLedgerEntry = apply { + fun validate(): Void = apply { if (validated) { return@apply } @@ -7353,7 +7278,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Void && 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 */ @@ -7363,10 +7288,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Void{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}" } - class VoidInitiatedLedgerEntry + class VoidInitiated private constructor( private val id: JsonField, private val amount: JsonField, @@ -7702,7 +7627,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidInitiatedLedgerEntry]. + * Returns a mutable builder for constructing an instance of [VoidInitiated]. * * The following fields are required: * ```java @@ -7726,7 +7651,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidInitiatedLedgerEntry]. */ + /** A builder for [VoidInitiated]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -7748,24 +7673,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - id = voidInitiatedLedgerEntry.id - amount = voidInitiatedLedgerEntry.amount - createdAt = voidInitiatedLedgerEntry.createdAt - 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 - startingBalance = voidInitiatedLedgerEntry.startingBalance - voidAmount = voidInitiatedLedgerEntry.voidAmount - voidReason = voidInitiatedLedgerEntry.voidReason - additionalProperties = voidInitiatedLedgerEntry.additionalProperties.toMutableMap() + internal fun from(voidInitiated: VoidInitiated) = apply { + id = voidInitiated.id + amount = voidInitiated.amount + createdAt = voidInitiated.createdAt + creditBlock = voidInitiated.creditBlock + currency = voidInitiated.currency + customer = voidInitiated.customer + description = voidInitiated.description + endingBalance = voidInitiated.endingBalance + entryStatus = voidInitiated.entryStatus + entryType = voidInitiated.entryType + ledgerSequenceNumber = voidInitiated.ledgerSequenceNumber + metadata = voidInitiated.metadata + newBlockExpiryDate = voidInitiated.newBlockExpiryDate + startingBalance = voidInitiated.startingBalance + voidAmount = voidInitiated.voidAmount + voidReason = voidInitiated.voidReason + additionalProperties = voidInitiated.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -7997,7 +7922,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidInitiatedLedgerEntry]. + * Returns an immutable instance of [VoidInitiated]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8022,8 +7947,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidInitiatedLedgerEntry = - VoidInitiatedLedgerEntry( + fun build(): VoidInitiated = + VoidInitiated( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -8046,7 +7971,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidInitiatedLedgerEntry = apply { + fun validate(): VoidInitiated = apply { if (validated) { return@apply } @@ -8815,7 +8740,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is VoidInitiated && 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 */ @@ -8825,10 +8750,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "VoidInitiated{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}" } - class AmendmentLedgerEntry + class Amendment private constructor( private val id: JsonField, private val amount: JsonField, @@ -9102,7 +9027,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [AmendmentLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Amendment]. * * The following fields are required: * ```java @@ -9123,7 +9048,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmendmentLedgerEntry]. */ + /** A builder for [Amendment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9142,21 +9067,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - id = amendmentLedgerEntry.id - amount = amendmentLedgerEntry.amount - createdAt = amendmentLedgerEntry.createdAt - 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() + internal fun from(amendment: Amendment) = apply { + id = amendment.id + amount = amendment.amount + createdAt = amendment.createdAt + creditBlock = amendment.creditBlock + currency = amendment.currency + customer = amendment.customer + description = amendment.description + endingBalance = amendment.endingBalance + entryStatus = amendment.entryStatus + entryType = amendment.entryType + ledgerSequenceNumber = amendment.ledgerSequenceNumber + metadata = amendment.metadata + startingBalance = amendment.startingBalance + additionalProperties = amendment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9349,7 +9274,7 @@ private constructor( } /** - * Returns an immutable instance of [AmendmentLedgerEntry]. + * Returns an immutable instance of [Amendment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9371,8 +9296,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmendmentLedgerEntry = - AmendmentLedgerEntry( + fun build(): Amendment = + Amendment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -9392,7 +9317,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmendmentLedgerEntry = apply { + fun validate(): Amendment = apply { if (validated) { return@apply } @@ -10155,7 +10080,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amendment && 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 */ @@ -10165,6 +10090,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Amendment{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/CustomerCreditLedgerListByExternalIdPageResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponse.kt index 22f897888..ab3f2d31a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponse.kt @@ -141,91 +141,60 @@ private constructor( /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofIncrementLedgerEntry(incrementLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofIncrement(increment)`. */ - fun addData( - incrementLedgerEntry: CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - ) = - addData( - CustomerCreditLedgerListByExternalIdResponse.ofIncrementLedgerEntry( - incrementLedgerEntry - ) - ) + fun addData(increment: CustomerCreditLedgerListByExternalIdResponse.Increment) = + addData(CustomerCreditLedgerListByExternalIdResponse.ofIncrement(increment)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofDecrementLedgerEntry(decrementLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofDecrement(decrement)`. */ - fun addData( - decrementLedgerEntry: CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry - ) = - addData( - CustomerCreditLedgerListByExternalIdResponse.ofDecrementLedgerEntry( - decrementLedgerEntry - ) - ) + fun addData(decrement: CustomerCreditLedgerListByExternalIdResponse.Decrement) = + addData(CustomerCreditLedgerListByExternalIdResponse.ofDecrement(decrement)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofExpirationChangeLedgerEntry(expirationChangeLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofExpirationChange(expirationChange)`. */ fun addData( - expirationChangeLedgerEntry: - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry + expirationChange: CustomerCreditLedgerListByExternalIdResponse.ExpirationChange ) = addData( - CustomerCreditLedgerListByExternalIdResponse.ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry - ) + CustomerCreditLedgerListByExternalIdResponse.ofExpirationChange(expirationChange) ) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiryLedgerEntry(creditBlockExpiryLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiry(creditBlockExpiry)`. */ fun addData( - creditBlockExpiryLedgerEntry: - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry + creditBlockExpiry: CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry ) = addData( - CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry - ) + CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiry(creditBlockExpiry) ) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofVoidLedgerEntry(voidLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofVoid(void_)`. */ - fun addData(voidLedgerEntry: CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry) = - addData(CustomerCreditLedgerListByExternalIdResponse.ofVoidLedgerEntry(voidLedgerEntry)) + fun addData(void_: CustomerCreditLedgerListByExternalIdResponse.Void) = + addData(CustomerCreditLedgerListByExternalIdResponse.ofVoid(void_)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiated(voidInitiated)`. */ - fun addData( - voidInitiatedLedgerEntry: - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - ) = - addData( - CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry - ) - ) + fun addData(voidInitiated: CustomerCreditLedgerListByExternalIdResponse.VoidInitiated) = + addData(CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiated(voidInitiated)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListByExternalIdResponse.ofAmendmentLedgerEntry(amendmentLedgerEntry)`. + * `CustomerCreditLedgerListByExternalIdResponse.ofAmendment(amendment)`. */ - fun addData( - amendmentLedgerEntry: CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry - ) = - addData( - CustomerCreditLedgerListByExternalIdResponse.ofAmendmentLedgerEntry( - amendmentLedgerEntry - ) - ) + fun addData(amendment: CustomerCreditLedgerListByExternalIdResponse.Amendment) = + addData(CustomerCreditLedgerListByExternalIdResponse.ofAmendment(amendment)) fun paginationMetadata(paginationMetadata: PaginationMetadata) = paginationMetadata(JsonField.of(paginationMetadata)) 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 6341893f9..bca8107b6 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 @@ -38,84 +38,69 @@ import kotlin.jvm.optionals.getOrNull @JsonSerialize(using = CustomerCreditLedgerListByExternalIdResponse.Serializer::class) class CustomerCreditLedgerListByExternalIdResponse private constructor( - private val incrementLedgerEntry: IncrementLedgerEntry? = null, - private val decrementLedgerEntry: DecrementLedgerEntry? = null, - private val expirationChangeLedgerEntry: ExpirationChangeLedgerEntry? = null, - private val creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry? = null, - private val voidLedgerEntry: VoidLedgerEntry? = null, - private val voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry? = null, - private val amendmentLedgerEntry: AmendmentLedgerEntry? = null, + private val increment: Increment? = null, + private val decrement: Decrement? = null, + private val expirationChange: ExpirationChange? = null, + private val creditBlockExpiry: CreditBlockExpiry? = null, + private val void_: Void? = null, + private val voidInitiated: VoidInitiated? = null, + private val amendment: Amendment? = null, private val _json: JsonValue? = null, ) { - fun incrementLedgerEntry(): Optional = - Optional.ofNullable(incrementLedgerEntry) + fun increment(): Optional = Optional.ofNullable(increment) - fun decrementLedgerEntry(): Optional = - Optional.ofNullable(decrementLedgerEntry) + fun decrement(): Optional = Optional.ofNullable(decrement) - fun expirationChangeLedgerEntry(): Optional = - Optional.ofNullable(expirationChangeLedgerEntry) + fun expirationChange(): Optional = Optional.ofNullable(expirationChange) - fun creditBlockExpiryLedgerEntry(): Optional = - Optional.ofNullable(creditBlockExpiryLedgerEntry) + fun creditBlockExpiry(): Optional = Optional.ofNullable(creditBlockExpiry) - fun voidLedgerEntry(): Optional = Optional.ofNullable(voidLedgerEntry) + fun void_(): Optional = Optional.ofNullable(void_) - fun voidInitiatedLedgerEntry(): Optional = - Optional.ofNullable(voidInitiatedLedgerEntry) + fun voidInitiated(): Optional = Optional.ofNullable(voidInitiated) - fun amendmentLedgerEntry(): Optional = - Optional.ofNullable(amendmentLedgerEntry) + fun amendment(): Optional = Optional.ofNullable(amendment) - fun isIncrementLedgerEntry(): Boolean = incrementLedgerEntry != null + fun isIncrement(): Boolean = increment != null - fun isDecrementLedgerEntry(): Boolean = decrementLedgerEntry != null + fun isDecrement(): Boolean = decrement != null - fun isExpirationChangeLedgerEntry(): Boolean = expirationChangeLedgerEntry != null + fun isExpirationChange(): Boolean = expirationChange != null - fun isCreditBlockExpiryLedgerEntry(): Boolean = creditBlockExpiryLedgerEntry != null + fun isCreditBlockExpiry(): Boolean = creditBlockExpiry != null - fun isVoidLedgerEntry(): Boolean = voidLedgerEntry != null + fun isVoid(): Boolean = void_ != null - fun isVoidInitiatedLedgerEntry(): Boolean = voidInitiatedLedgerEntry != null + fun isVoidInitiated(): Boolean = voidInitiated != null - fun isAmendmentLedgerEntry(): Boolean = amendmentLedgerEntry != null + fun isAmendment(): Boolean = amendment != null - fun asIncrementLedgerEntry(): IncrementLedgerEntry = - incrementLedgerEntry.getOrThrow("incrementLedgerEntry") + fun asIncrement(): Increment = increment.getOrThrow("increment") - fun asDecrementLedgerEntry(): DecrementLedgerEntry = - decrementLedgerEntry.getOrThrow("decrementLedgerEntry") + fun asDecrement(): Decrement = decrement.getOrThrow("decrement") - fun asExpirationChangeLedgerEntry(): ExpirationChangeLedgerEntry = - expirationChangeLedgerEntry.getOrThrow("expirationChangeLedgerEntry") + fun asExpirationChange(): ExpirationChange = expirationChange.getOrThrow("expirationChange") - fun asCreditBlockExpiryLedgerEntry(): CreditBlockExpiryLedgerEntry = - creditBlockExpiryLedgerEntry.getOrThrow("creditBlockExpiryLedgerEntry") + fun asCreditBlockExpiry(): CreditBlockExpiry = creditBlockExpiry.getOrThrow("creditBlockExpiry") - fun asVoidLedgerEntry(): VoidLedgerEntry = voidLedgerEntry.getOrThrow("voidLedgerEntry") + fun asVoid(): Void = void_.getOrThrow("void_") - fun asVoidInitiatedLedgerEntry(): VoidInitiatedLedgerEntry = - voidInitiatedLedgerEntry.getOrThrow("voidInitiatedLedgerEntry") + fun asVoidInitiated(): VoidInitiated = voidInitiated.getOrThrow("voidInitiated") - fun asAmendmentLedgerEntry(): AmendmentLedgerEntry = - amendmentLedgerEntry.getOrThrow("amendmentLedgerEntry") + fun asAmendment(): Amendment = amendment.getOrThrow("amendment") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry) - decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry) - expirationChangeLedgerEntry != null -> - visitor.visitExpirationChangeLedgerEntry(expirationChangeLedgerEntry) - creditBlockExpiryLedgerEntry != null -> - visitor.visitCreditBlockExpiryLedgerEntry(creditBlockExpiryLedgerEntry) - voidLedgerEntry != null -> visitor.visitVoidLedgerEntry(voidLedgerEntry) - voidInitiatedLedgerEntry != null -> - visitor.visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry) - amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry) + increment != null -> visitor.visitIncrement(increment) + decrement != null -> visitor.visitDecrement(decrement) + expirationChange != null -> visitor.visitExpirationChange(expirationChange) + creditBlockExpiry != null -> visitor.visitCreditBlockExpiry(creditBlockExpiry) + void_ != null -> visitor.visitVoid(void_) + voidInitiated != null -> visitor.visitVoidInitiated(voidInitiated) + amendment != null -> visitor.visitAmendment(amendment) else -> visitor.unknown(_json) } @@ -128,38 +113,32 @@ private constructor( accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) { - incrementLedgerEntry.validate() + override fun visitIncrement(increment: Increment) { + increment.validate() } - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) { - decrementLedgerEntry.validate() + override fun visitDecrement(decrement: Decrement) { + decrement.validate() } - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) { - expirationChangeLedgerEntry.validate() + override fun visitExpirationChange(expirationChange: ExpirationChange) { + expirationChange.validate() } - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) { - creditBlockExpiryLedgerEntry.validate() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) { + creditBlockExpiry.validate() } - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) { - voidLedgerEntry.validate() + override fun visitVoid(void_: Void) { + void_.validate() } - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) { - voidInitiatedLedgerEntry.validate() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) { + voidInitiated.validate() } - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) { - amendmentLedgerEntry.validate() + override fun visitAmendment(amendment: Amendment) { + amendment.validate() } } ) @@ -183,29 +162,22 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - incrementLedgerEntry.validity() + override fun visitIncrement(increment: Increment) = increment.validity() - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - decrementLedgerEntry.validity() + override fun visitDecrement(decrement: Decrement) = decrement.validity() - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = expirationChangeLedgerEntry.validity() + override fun visitExpirationChange(expirationChange: ExpirationChange) = + expirationChange.validity() - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = creditBlockExpiryLedgerEntry.validity() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + creditBlockExpiry.validity() - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - voidLedgerEntry.validity() + override fun visitVoid(void_: Void) = void_.validity() - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) = voidInitiatedLedgerEntry.validity() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) = + voidInitiated.validity() - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - amendmentLedgerEntry.validity() + override fun visitAmendment(amendment: Amendment) = amendment.validity() override fun unknown(json: JsonValue?) = 0 } @@ -216,27 +188,26 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditLedgerListByExternalIdResponse && incrementLedgerEntry == other.incrementLedgerEntry && decrementLedgerEntry == other.decrementLedgerEntry && expirationChangeLedgerEntry == other.expirationChangeLedgerEntry && creditBlockExpiryLedgerEntry == other.creditBlockExpiryLedgerEntry && voidLedgerEntry == other.voidLedgerEntry && voidInitiatedLedgerEntry == other.voidInitiatedLedgerEntry && amendmentLedgerEntry == other.amendmentLedgerEntry /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerListByExternalIdResponse && increment == other.increment && decrement == other.decrement && expirationChange == other.expirationChange && creditBlockExpiry == other.creditBlockExpiry && void_ == other.void_ && voidInitiated == other.voidInitiated && amendment == other.amendment /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(incrementLedgerEntry, decrementLedgerEntry, expirationChangeLedgerEntry, creditBlockExpiryLedgerEntry, voidLedgerEntry, voidInitiatedLedgerEntry, amendmentLedgerEntry) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(increment, decrement, expirationChange, creditBlockExpiry, void_, voidInitiated, amendment) /* spotless:on */ override fun toString(): String = when { - incrementLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{incrementLedgerEntry=$incrementLedgerEntry}" - decrementLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{decrementLedgerEntry=$decrementLedgerEntry}" - expirationChangeLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{expirationChangeLedgerEntry=$expirationChangeLedgerEntry}" - creditBlockExpiryLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{creditBlockExpiryLedgerEntry=$creditBlockExpiryLedgerEntry}" - voidLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{voidLedgerEntry=$voidLedgerEntry}" - voidInitiatedLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{voidInitiatedLedgerEntry=$voidInitiatedLedgerEntry}" - amendmentLedgerEntry != null -> - "CustomerCreditLedgerListByExternalIdResponse{amendmentLedgerEntry=$amendmentLedgerEntry}" + increment != null -> + "CustomerCreditLedgerListByExternalIdResponse{increment=$increment}" + decrement != null -> + "CustomerCreditLedgerListByExternalIdResponse{decrement=$decrement}" + expirationChange != null -> + "CustomerCreditLedgerListByExternalIdResponse{expirationChange=$expirationChange}" + creditBlockExpiry != null -> + "CustomerCreditLedgerListByExternalIdResponse{creditBlockExpiry=$creditBlockExpiry}" + void_ != null -> "CustomerCreditLedgerListByExternalIdResponse{void_=$void_}" + voidInitiated != null -> + "CustomerCreditLedgerListByExternalIdResponse{voidInitiated=$voidInitiated}" + amendment != null -> + "CustomerCreditLedgerListByExternalIdResponse{amendment=$amendment}" _json != null -> "CustomerCreditLedgerListByExternalIdResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid CustomerCreditLedgerListByExternalIdResponse") @@ -245,48 +216,31 @@ private constructor( companion object { @JvmStatic - fun ofIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - CustomerCreditLedgerListByExternalIdResponse( - incrementLedgerEntry = incrementLedgerEntry - ) + fun ofIncrement(increment: Increment) = + CustomerCreditLedgerListByExternalIdResponse(increment = increment) @JvmStatic - fun ofDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - CustomerCreditLedgerListByExternalIdResponse( - decrementLedgerEntry = decrementLedgerEntry - ) + fun ofDecrement(decrement: Decrement) = + CustomerCreditLedgerListByExternalIdResponse(decrement = decrement) @JvmStatic - fun ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = - CustomerCreditLedgerListByExternalIdResponse( - expirationChangeLedgerEntry = expirationChangeLedgerEntry - ) + fun ofExpirationChange(expirationChange: ExpirationChange) = + CustomerCreditLedgerListByExternalIdResponse(expirationChange = expirationChange) @JvmStatic - fun ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = - CustomerCreditLedgerListByExternalIdResponse( - creditBlockExpiryLedgerEntry = creditBlockExpiryLedgerEntry - ) + fun ofCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + CustomerCreditLedgerListByExternalIdResponse(creditBlockExpiry = creditBlockExpiry) @JvmStatic - fun ofVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - CustomerCreditLedgerListByExternalIdResponse(voidLedgerEntry = voidLedgerEntry) + fun ofVoid(void_: Void) = CustomerCreditLedgerListByExternalIdResponse(void_ = void_) @JvmStatic - fun ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = - CustomerCreditLedgerListByExternalIdResponse( - voidInitiatedLedgerEntry = voidInitiatedLedgerEntry - ) + fun ofVoidInitiated(voidInitiated: VoidInitiated) = + CustomerCreditLedgerListByExternalIdResponse(voidInitiated = voidInitiated) @JvmStatic - fun ofAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - CustomerCreditLedgerListByExternalIdResponse( - amendmentLedgerEntry = amendmentLedgerEntry - ) + fun ofAmendment(amendment: Amendment) = + CustomerCreditLedgerListByExternalIdResponse(amendment = amendment) } /** @@ -295,23 +249,19 @@ private constructor( */ interface Visitor { - fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry): T + fun visitIncrement(increment: Increment): T - fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry): T + fun visitDecrement(decrement: Decrement): T - fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ): T + fun visitExpirationChange(expirationChange: ExpirationChange): T - fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ): T + fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry): T - fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry): T + fun visitVoid(void_: Void): T - fun visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry): T + fun visitVoidInitiated(voidInitiated: VoidInitiated): T - fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry): T + fun visitAmendment(amendment: Amendment): T /** * Maps an unknown variant of [CustomerCreditLedgerListByExternalIdResponse] to a value of @@ -344,61 +294,47 @@ private constructor( when (entryType) { "increment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListByExternalIdResponse( - incrementLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListByExternalIdResponse(increment = it, _json = json) } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) } "decrement" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListByExternalIdResponse(decrement = it, _json = json) + } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) + } + "expiration_change" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerListByExternalIdResponse( - decrementLedgerEntry = it, + expirationChange = it, _json = json, ) } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) } - "expiration_change" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerListByExternalIdResponse( - expirationChangeLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) - } "credit_block_expiry" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerListByExternalIdResponse( - creditBlockExpiryLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) - } - "void" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerListByExternalIdResponse( - voidLedgerEntry = it, + creditBlockExpiry = it, _json = json, ) } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) } + "void" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListByExternalIdResponse(void_ = it, _json = json) + } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) + } "void_initiated" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { CustomerCreditLedgerListByExternalIdResponse( - voidInitiatedLedgerEntry = it, + voidInitiated = it, _json = json, ) } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) } "amendment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListByExternalIdResponse( - amendmentLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListByExternalIdResponse(amendment = it, _json = json) } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json) } } @@ -418,19 +354,13 @@ private constructor( provider: SerializerProvider, ) { when { - value.incrementLedgerEntry != null -> - generator.writeObject(value.incrementLedgerEntry) - value.decrementLedgerEntry != null -> - generator.writeObject(value.decrementLedgerEntry) - value.expirationChangeLedgerEntry != null -> - generator.writeObject(value.expirationChangeLedgerEntry) - value.creditBlockExpiryLedgerEntry != null -> - generator.writeObject(value.creditBlockExpiryLedgerEntry) - value.voidLedgerEntry != null -> generator.writeObject(value.voidLedgerEntry) - value.voidInitiatedLedgerEntry != null -> - generator.writeObject(value.voidInitiatedLedgerEntry) - value.amendmentLedgerEntry != null -> - generator.writeObject(value.amendmentLedgerEntry) + value.increment != null -> generator.writeObject(value.increment) + value.decrement != null -> generator.writeObject(value.decrement) + value.expirationChange != null -> generator.writeObject(value.expirationChange) + value.creditBlockExpiry != null -> generator.writeObject(value.creditBlockExpiry) + value.void_ != null -> generator.writeObject(value.void_) + value.voidInitiated != null -> generator.writeObject(value.voidInitiated) + value.amendment != null -> generator.writeObject(value.amendment) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException( @@ -440,7 +370,7 @@ private constructor( } } - class IncrementLedgerEntry + class Increment private constructor( private val id: JsonField, private val amount: JsonField, @@ -714,7 +644,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [IncrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Increment]. * * The following fields are required: * ```java @@ -735,7 +665,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [IncrementLedgerEntry]. */ + /** A builder for [Increment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -754,21 +684,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - id = incrementLedgerEntry.id - amount = incrementLedgerEntry.amount - createdAt = incrementLedgerEntry.createdAt - 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() + internal fun from(increment: Increment) = apply { + id = increment.id + amount = increment.amount + createdAt = increment.createdAt + creditBlock = increment.creditBlock + currency = increment.currency + customer = increment.customer + description = increment.description + endingBalance = increment.endingBalance + entryStatus = increment.entryStatus + entryType = increment.entryType + ledgerSequenceNumber = increment.ledgerSequenceNumber + metadata = increment.metadata + startingBalance = increment.startingBalance + additionalProperties = increment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -961,7 +891,7 @@ private constructor( } /** - * Returns an immutable instance of [IncrementLedgerEntry]. + * Returns an immutable instance of [Increment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -983,8 +913,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): IncrementLedgerEntry = - IncrementLedgerEntry( + fun build(): Increment = + Increment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -1004,7 +934,7 @@ private constructor( private var validated: Boolean = false - fun validate(): IncrementLedgerEntry = apply { + fun validate(): Increment = apply { if (validated) { return@apply } @@ -1767,7 +1697,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Increment && 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 */ @@ -1777,10 +1707,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Increment{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}" } - class DecrementLedgerEntry + class Decrement private constructor( private val id: JsonField, private val amount: JsonField, @@ -2104,7 +2034,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [DecrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Decrement]. * * The following fields are required: * ```java @@ -2125,7 +2055,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DecrementLedgerEntry]. */ + /** A builder for [Decrement]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2147,24 +2077,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - id = decrementLedgerEntry.id - amount = decrementLedgerEntry.amount - createdAt = decrementLedgerEntry.createdAt - creditBlock = decrementLedgerEntry.creditBlock - currency = decrementLedgerEntry.currency - customer = decrementLedgerEntry.customer - description = decrementLedgerEntry.description - endingBalance = decrementLedgerEntry.endingBalance - entryStatus = decrementLedgerEntry.entryStatus - entryType = decrementLedgerEntry.entryType - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - metadata = decrementLedgerEntry.metadata - startingBalance = decrementLedgerEntry.startingBalance - eventId = decrementLedgerEntry.eventId - invoiceId = decrementLedgerEntry.invoiceId - priceId = decrementLedgerEntry.priceId - additionalProperties = decrementLedgerEntry.additionalProperties.toMutableMap() + internal fun from(decrement: Decrement) = apply { + id = decrement.id + amount = decrement.amount + createdAt = decrement.createdAt + creditBlock = decrement.creditBlock + currency = decrement.currency + customer = decrement.customer + description = decrement.description + endingBalance = decrement.endingBalance + entryStatus = decrement.entryStatus + entryType = decrement.entryType + ledgerSequenceNumber = decrement.ledgerSequenceNumber + metadata = decrement.metadata + startingBalance = decrement.startingBalance + eventId = decrement.eventId + invoiceId = decrement.invoiceId + priceId = decrement.priceId + additionalProperties = decrement.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2399,7 +2329,7 @@ private constructor( } /** - * Returns an immutable instance of [DecrementLedgerEntry]. + * Returns an immutable instance of [Decrement]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2421,8 +2351,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): DecrementLedgerEntry = - DecrementLedgerEntry( + fun build(): Decrement = + Decrement( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -2445,7 +2375,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DecrementLedgerEntry = apply { + fun validate(): Decrement = apply { if (validated) { return@apply } @@ -3214,7 +3144,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Decrement && 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 */ @@ -3224,10 +3154,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Decrement{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}" } - class ExpirationChangeLedgerEntry + class ExpirationChange private constructor( private val id: JsonField, private val amount: JsonField, @@ -3523,8 +3453,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [ExpirationChangeLedgerEntry]. + * Returns a mutable builder for constructing an instance of [ExpirationChange]. * * The following fields are required: * ```java @@ -3546,7 +3475,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ExpirationChangeLedgerEntry]. */ + /** A builder for [ExpirationChange]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3566,23 +3495,22 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - id = expirationChangeLedgerEntry.id - amount = expirationChangeLedgerEntry.amount - createdAt = expirationChangeLedgerEntry.createdAt - 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() + internal fun from(expirationChange: ExpirationChange) = apply { + id = expirationChange.id + amount = expirationChange.amount + createdAt = expirationChange.createdAt + creditBlock = expirationChange.creditBlock + currency = expirationChange.currency + customer = expirationChange.customer + description = expirationChange.description + endingBalance = expirationChange.endingBalance + entryStatus = expirationChange.entryStatus + entryType = expirationChange.entryType + ledgerSequenceNumber = expirationChange.ledgerSequenceNumber + metadata = expirationChange.metadata + newBlockExpiryDate = expirationChange.newBlockExpiryDate + startingBalance = expirationChange.startingBalance + additionalProperties = expirationChange.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3796,7 +3724,7 @@ private constructor( } /** - * Returns an immutable instance of [ExpirationChangeLedgerEntry]. + * Returns an immutable instance of [ExpirationChange]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3819,8 +3747,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ExpirationChangeLedgerEntry = - ExpirationChangeLedgerEntry( + fun build(): ExpirationChange = + ExpirationChange( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -3841,7 +3769,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ExpirationChangeLedgerEntry = apply { + fun validate(): ExpirationChange = apply { if (validated) { return@apply } @@ -4606,7 +4534,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ExpirationChange && 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 */ @@ -4616,10 +4544,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ExpirationChange{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}" } - class CreditBlockExpiryLedgerEntry + class CreditBlockExpiry private constructor( private val id: JsonField, private val amount: JsonField, @@ -4893,8 +4821,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CreditBlockExpiryLedgerEntry]. + * Returns a mutable builder for constructing an instance of [CreditBlockExpiry]. * * The following fields are required: * ```java @@ -4915,7 +4842,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CreditBlockExpiryLedgerEntry]. */ + /** A builder for [CreditBlockExpiry]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4934,22 +4861,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - id = creditBlockExpiryLedgerEntry.id - amount = creditBlockExpiryLedgerEntry.amount - createdAt = creditBlockExpiryLedgerEntry.createdAt - 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() + internal fun from(creditBlockExpiry: CreditBlockExpiry) = apply { + id = creditBlockExpiry.id + amount = creditBlockExpiry.amount + createdAt = creditBlockExpiry.createdAt + creditBlock = creditBlockExpiry.creditBlock + currency = creditBlockExpiry.currency + customer = creditBlockExpiry.customer + description = creditBlockExpiry.description + endingBalance = creditBlockExpiry.endingBalance + entryStatus = creditBlockExpiry.entryStatus + entryType = creditBlockExpiry.entryType + ledgerSequenceNumber = creditBlockExpiry.ledgerSequenceNumber + metadata = creditBlockExpiry.metadata + startingBalance = creditBlockExpiry.startingBalance + additionalProperties = creditBlockExpiry.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -5142,7 +5068,7 @@ private constructor( } /** - * Returns an immutable instance of [CreditBlockExpiryLedgerEntry]. + * Returns an immutable instance of [CreditBlockExpiry]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5164,8 +5090,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): CreditBlockExpiryLedgerEntry = - CreditBlockExpiryLedgerEntry( + fun build(): CreditBlockExpiry = + CreditBlockExpiry( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -5185,7 +5111,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CreditBlockExpiryLedgerEntry = apply { + fun validate(): CreditBlockExpiry = apply { if (validated) { return@apply } @@ -5948,7 +5874,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is CreditBlockExpiry && 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 */ @@ -5958,10 +5884,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "CreditBlockExpiry{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}" } - class VoidLedgerEntry + class Void private constructor( private val id: JsonField, private val amount: JsonField, @@ -6275,7 +6201,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Void]. * * The following fields are required: * ```java @@ -6298,7 +6224,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidLedgerEntry]. */ + /** A builder for [Void]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -6319,23 +6245,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - id = voidLedgerEntry.id - amount = voidLedgerEntry.amount - createdAt = voidLedgerEntry.createdAt - creditBlock = voidLedgerEntry.creditBlock - currency = voidLedgerEntry.currency - customer = voidLedgerEntry.customer - description = voidLedgerEntry.description - endingBalance = voidLedgerEntry.endingBalance - entryStatus = voidLedgerEntry.entryStatus - entryType = voidLedgerEntry.entryType - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - metadata = voidLedgerEntry.metadata - startingBalance = voidLedgerEntry.startingBalance - voidAmount = voidLedgerEntry.voidAmount - voidReason = voidLedgerEntry.voidReason - additionalProperties = voidLedgerEntry.additionalProperties.toMutableMap() + internal fun from(void_: Void) = apply { + id = void_.id + amount = void_.amount + createdAt = void_.createdAt + creditBlock = void_.creditBlock + currency = void_.currency + customer = void_.customer + description = void_.description + endingBalance = void_.endingBalance + entryStatus = void_.entryStatus + entryType = void_.entryType + ledgerSequenceNumber = void_.ledgerSequenceNumber + metadata = void_.metadata + startingBalance = void_.startingBalance + voidAmount = void_.voidAmount + voidReason = void_.voidReason + additionalProperties = void_.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -6553,7 +6479,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidLedgerEntry]. + * Returns an immutable instance of [Void]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6577,8 +6503,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidLedgerEntry = - VoidLedgerEntry( + fun build(): Void = + Void( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -6600,7 +6526,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidLedgerEntry = apply { + fun validate(): Void = apply { if (validated) { return@apply } @@ -7367,7 +7293,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Void && 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 */ @@ -7377,10 +7303,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Void{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}" } - class VoidInitiatedLedgerEntry + class VoidInitiated private constructor( private val id: JsonField, private val amount: JsonField, @@ -7716,7 +7642,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidInitiatedLedgerEntry]. + * Returns a mutable builder for constructing an instance of [VoidInitiated]. * * The following fields are required: * ```java @@ -7740,7 +7666,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidInitiatedLedgerEntry]. */ + /** A builder for [VoidInitiated]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -7762,24 +7688,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - id = voidInitiatedLedgerEntry.id - amount = voidInitiatedLedgerEntry.amount - createdAt = voidInitiatedLedgerEntry.createdAt - 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 - startingBalance = voidInitiatedLedgerEntry.startingBalance - voidAmount = voidInitiatedLedgerEntry.voidAmount - voidReason = voidInitiatedLedgerEntry.voidReason - additionalProperties = voidInitiatedLedgerEntry.additionalProperties.toMutableMap() + internal fun from(voidInitiated: VoidInitiated) = apply { + id = voidInitiated.id + amount = voidInitiated.amount + createdAt = voidInitiated.createdAt + creditBlock = voidInitiated.creditBlock + currency = voidInitiated.currency + customer = voidInitiated.customer + description = voidInitiated.description + endingBalance = voidInitiated.endingBalance + entryStatus = voidInitiated.entryStatus + entryType = voidInitiated.entryType + ledgerSequenceNumber = voidInitiated.ledgerSequenceNumber + metadata = voidInitiated.metadata + newBlockExpiryDate = voidInitiated.newBlockExpiryDate + startingBalance = voidInitiated.startingBalance + voidAmount = voidInitiated.voidAmount + voidReason = voidInitiated.voidReason + additionalProperties = voidInitiated.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -8011,7 +7937,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidInitiatedLedgerEntry]. + * Returns an immutable instance of [VoidInitiated]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8036,8 +7962,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidInitiatedLedgerEntry = - VoidInitiatedLedgerEntry( + fun build(): VoidInitiated = + VoidInitiated( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -8060,7 +7986,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidInitiatedLedgerEntry = apply { + fun validate(): VoidInitiated = apply { if (validated) { return@apply } @@ -8829,7 +8755,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is VoidInitiated && 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 */ @@ -8839,10 +8765,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "VoidInitiated{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}" } - class AmendmentLedgerEntry + class Amendment private constructor( private val id: JsonField, private val amount: JsonField, @@ -9116,7 +9042,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [AmendmentLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Amendment]. * * The following fields are required: * ```java @@ -9137,7 +9063,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmendmentLedgerEntry]. */ + /** A builder for [Amendment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9156,21 +9082,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - id = amendmentLedgerEntry.id - amount = amendmentLedgerEntry.amount - createdAt = amendmentLedgerEntry.createdAt - 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() + internal fun from(amendment: Amendment) = apply { + id = amendment.id + amount = amendment.amount + createdAt = amendment.createdAt + creditBlock = amendment.creditBlock + currency = amendment.currency + customer = amendment.customer + description = amendment.description + endingBalance = amendment.endingBalance + entryStatus = amendment.entryStatus + entryType = amendment.entryType + ledgerSequenceNumber = amendment.ledgerSequenceNumber + metadata = amendment.metadata + startingBalance = amendment.startingBalance + additionalProperties = amendment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9363,7 +9289,7 @@ private constructor( } /** - * Returns an immutable instance of [AmendmentLedgerEntry]. + * Returns an immutable instance of [Amendment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9385,8 +9311,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmendmentLedgerEntry = - AmendmentLedgerEntry( + fun build(): Amendment = + Amendment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -9406,7 +9332,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmendmentLedgerEntry = apply { + fun validate(): Amendment = apply { if (validated) { return@apply } @@ -10169,7 +10095,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amendment && 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 */ @@ -10179,6 +10105,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Amendment{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/CustomerCreditLedgerListPageResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponse.kt index 645d99e3e..92af44c8d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponse.kt @@ -138,72 +138,49 @@ private constructor( /** * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofIncrementLedgerEntry(incrementLedgerEntry)`. + * `CustomerCreditLedgerListResponse.ofIncrement(increment)`. */ - fun addData(incrementLedgerEntry: CustomerCreditLedgerListResponse.IncrementLedgerEntry) = - addData(CustomerCreditLedgerListResponse.ofIncrementLedgerEntry(incrementLedgerEntry)) + fun addData(increment: CustomerCreditLedgerListResponse.Increment) = + addData(CustomerCreditLedgerListResponse.ofIncrement(increment)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofDecrementLedgerEntry(decrementLedgerEntry)`. + * `CustomerCreditLedgerListResponse.ofDecrement(decrement)`. */ - fun addData(decrementLedgerEntry: CustomerCreditLedgerListResponse.DecrementLedgerEntry) = - addData(CustomerCreditLedgerListResponse.ofDecrementLedgerEntry(decrementLedgerEntry)) + fun addData(decrement: CustomerCreditLedgerListResponse.Decrement) = + addData(CustomerCreditLedgerListResponse.ofDecrement(decrement)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofExpirationChangeLedgerEntry(expirationChangeLedgerEntry)`. + * `CustomerCreditLedgerListResponse.ofExpirationChange(expirationChange)`. */ - fun addData( - expirationChangeLedgerEntry: - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry - ) = - addData( - CustomerCreditLedgerListResponse.ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry - ) - ) + fun addData(expirationChange: CustomerCreditLedgerListResponse.ExpirationChange) = + addData(CustomerCreditLedgerListResponse.ofExpirationChange(expirationChange)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofCreditBlockExpiryLedgerEntry(creditBlockExpiryLedgerEntry)`. + * `CustomerCreditLedgerListResponse.ofCreditBlockExpiry(creditBlockExpiry)`. */ - fun addData( - creditBlockExpiryLedgerEntry: - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry - ) = - addData( - CustomerCreditLedgerListResponse.ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry - ) - ) + fun addData(creditBlockExpiry: CustomerCreditLedgerListResponse.CreditBlockExpiry) = + addData(CustomerCreditLedgerListResponse.ofCreditBlockExpiry(creditBlockExpiry)) - /** - * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofVoidLedgerEntry(voidLedgerEntry)`. - */ - fun addData(voidLedgerEntry: CustomerCreditLedgerListResponse.VoidLedgerEntry) = - addData(CustomerCreditLedgerListResponse.ofVoidLedgerEntry(voidLedgerEntry)) + /** Alias for calling [addData] with `CustomerCreditLedgerListResponse.ofVoid(void_)`. */ + fun addData(void_: CustomerCreditLedgerListResponse.Void) = + addData(CustomerCreditLedgerListResponse.ofVoid(void_)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry)`. + * `CustomerCreditLedgerListResponse.ofVoidInitiated(voidInitiated)`. */ - fun addData( - voidInitiatedLedgerEntry: CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry - ) = - addData( - CustomerCreditLedgerListResponse.ofVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry - ) - ) + fun addData(voidInitiated: CustomerCreditLedgerListResponse.VoidInitiated) = + addData(CustomerCreditLedgerListResponse.ofVoidInitiated(voidInitiated)) /** * Alias for calling [addData] with - * `CustomerCreditLedgerListResponse.ofAmendmentLedgerEntry(amendmentLedgerEntry)`. + * `CustomerCreditLedgerListResponse.ofAmendment(amendment)`. */ - fun addData(amendmentLedgerEntry: CustomerCreditLedgerListResponse.AmendmentLedgerEntry) = - addData(CustomerCreditLedgerListResponse.ofAmendmentLedgerEntry(amendmentLedgerEntry)) + fun addData(amendment: CustomerCreditLedgerListResponse.Amendment) = + addData(CustomerCreditLedgerListResponse.ofAmendment(amendment)) fun paginationMetadata(paginationMetadata: PaginationMetadata) = paginationMetadata(JsonField.of(paginationMetadata)) 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 7c5725808..429b0a1b5 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 @@ -38,84 +38,69 @@ import kotlin.jvm.optionals.getOrNull @JsonSerialize(using = CustomerCreditLedgerListResponse.Serializer::class) class CustomerCreditLedgerListResponse private constructor( - private val incrementLedgerEntry: IncrementLedgerEntry? = null, - private val decrementLedgerEntry: DecrementLedgerEntry? = null, - private val expirationChangeLedgerEntry: ExpirationChangeLedgerEntry? = null, - private val creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry? = null, - private val voidLedgerEntry: VoidLedgerEntry? = null, - private val voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry? = null, - private val amendmentLedgerEntry: AmendmentLedgerEntry? = null, + private val increment: Increment? = null, + private val decrement: Decrement? = null, + private val expirationChange: ExpirationChange? = null, + private val creditBlockExpiry: CreditBlockExpiry? = null, + private val void_: Void? = null, + private val voidInitiated: VoidInitiated? = null, + private val amendment: Amendment? = null, private val _json: JsonValue? = null, ) { - fun incrementLedgerEntry(): Optional = - Optional.ofNullable(incrementLedgerEntry) + fun increment(): Optional = Optional.ofNullable(increment) - fun decrementLedgerEntry(): Optional = - Optional.ofNullable(decrementLedgerEntry) + fun decrement(): Optional = Optional.ofNullable(decrement) - fun expirationChangeLedgerEntry(): Optional = - Optional.ofNullable(expirationChangeLedgerEntry) + fun expirationChange(): Optional = Optional.ofNullable(expirationChange) - fun creditBlockExpiryLedgerEntry(): Optional = - Optional.ofNullable(creditBlockExpiryLedgerEntry) + fun creditBlockExpiry(): Optional = Optional.ofNullable(creditBlockExpiry) - fun voidLedgerEntry(): Optional = Optional.ofNullable(voidLedgerEntry) + fun void_(): Optional = Optional.ofNullable(void_) - fun voidInitiatedLedgerEntry(): Optional = - Optional.ofNullable(voidInitiatedLedgerEntry) + fun voidInitiated(): Optional = Optional.ofNullable(voidInitiated) - fun amendmentLedgerEntry(): Optional = - Optional.ofNullable(amendmentLedgerEntry) + fun amendment(): Optional = Optional.ofNullable(amendment) - fun isIncrementLedgerEntry(): Boolean = incrementLedgerEntry != null + fun isIncrement(): Boolean = increment != null - fun isDecrementLedgerEntry(): Boolean = decrementLedgerEntry != null + fun isDecrement(): Boolean = decrement != null - fun isExpirationChangeLedgerEntry(): Boolean = expirationChangeLedgerEntry != null + fun isExpirationChange(): Boolean = expirationChange != null - fun isCreditBlockExpiryLedgerEntry(): Boolean = creditBlockExpiryLedgerEntry != null + fun isCreditBlockExpiry(): Boolean = creditBlockExpiry != null - fun isVoidLedgerEntry(): Boolean = voidLedgerEntry != null + fun isVoid(): Boolean = void_ != null - fun isVoidInitiatedLedgerEntry(): Boolean = voidInitiatedLedgerEntry != null + fun isVoidInitiated(): Boolean = voidInitiated != null - fun isAmendmentLedgerEntry(): Boolean = amendmentLedgerEntry != null + fun isAmendment(): Boolean = amendment != null - fun asIncrementLedgerEntry(): IncrementLedgerEntry = - incrementLedgerEntry.getOrThrow("incrementLedgerEntry") + fun asIncrement(): Increment = increment.getOrThrow("increment") - fun asDecrementLedgerEntry(): DecrementLedgerEntry = - decrementLedgerEntry.getOrThrow("decrementLedgerEntry") + fun asDecrement(): Decrement = decrement.getOrThrow("decrement") - fun asExpirationChangeLedgerEntry(): ExpirationChangeLedgerEntry = - expirationChangeLedgerEntry.getOrThrow("expirationChangeLedgerEntry") + fun asExpirationChange(): ExpirationChange = expirationChange.getOrThrow("expirationChange") - fun asCreditBlockExpiryLedgerEntry(): CreditBlockExpiryLedgerEntry = - creditBlockExpiryLedgerEntry.getOrThrow("creditBlockExpiryLedgerEntry") + fun asCreditBlockExpiry(): CreditBlockExpiry = creditBlockExpiry.getOrThrow("creditBlockExpiry") - fun asVoidLedgerEntry(): VoidLedgerEntry = voidLedgerEntry.getOrThrow("voidLedgerEntry") + fun asVoid(): Void = void_.getOrThrow("void_") - fun asVoidInitiatedLedgerEntry(): VoidInitiatedLedgerEntry = - voidInitiatedLedgerEntry.getOrThrow("voidInitiatedLedgerEntry") + fun asVoidInitiated(): VoidInitiated = voidInitiated.getOrThrow("voidInitiated") - fun asAmendmentLedgerEntry(): AmendmentLedgerEntry = - amendmentLedgerEntry.getOrThrow("amendmentLedgerEntry") + fun asAmendment(): Amendment = amendment.getOrThrow("amendment") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry) - decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry) - expirationChangeLedgerEntry != null -> - visitor.visitExpirationChangeLedgerEntry(expirationChangeLedgerEntry) - creditBlockExpiryLedgerEntry != null -> - visitor.visitCreditBlockExpiryLedgerEntry(creditBlockExpiryLedgerEntry) - voidLedgerEntry != null -> visitor.visitVoidLedgerEntry(voidLedgerEntry) - voidInitiatedLedgerEntry != null -> - visitor.visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry) - amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry) + increment != null -> visitor.visitIncrement(increment) + decrement != null -> visitor.visitDecrement(decrement) + expirationChange != null -> visitor.visitExpirationChange(expirationChange) + creditBlockExpiry != null -> visitor.visitCreditBlockExpiry(creditBlockExpiry) + void_ != null -> visitor.visitVoid(void_) + voidInitiated != null -> visitor.visitVoidInitiated(voidInitiated) + amendment != null -> visitor.visitAmendment(amendment) else -> visitor.unknown(_json) } @@ -128,38 +113,32 @@ private constructor( accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) { - incrementLedgerEntry.validate() + override fun visitIncrement(increment: Increment) { + increment.validate() } - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) { - decrementLedgerEntry.validate() + override fun visitDecrement(decrement: Decrement) { + decrement.validate() } - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) { - expirationChangeLedgerEntry.validate() + override fun visitExpirationChange(expirationChange: ExpirationChange) { + expirationChange.validate() } - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) { - creditBlockExpiryLedgerEntry.validate() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) { + creditBlockExpiry.validate() } - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) { - voidLedgerEntry.validate() + override fun visitVoid(void_: Void) { + void_.validate() } - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) { - voidInitiatedLedgerEntry.validate() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) { + voidInitiated.validate() } - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) { - amendmentLedgerEntry.validate() + override fun visitAmendment(amendment: Amendment) { + amendment.validate() } } ) @@ -183,29 +162,22 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - incrementLedgerEntry.validity() + override fun visitIncrement(increment: Increment) = increment.validity() - override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - decrementLedgerEntry.validity() + override fun visitDecrement(decrement: Decrement) = decrement.validity() - override fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = expirationChangeLedgerEntry.validity() + override fun visitExpirationChange(expirationChange: ExpirationChange) = + expirationChange.validity() - override fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = creditBlockExpiryLedgerEntry.validity() + override fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + creditBlockExpiry.validity() - override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - voidLedgerEntry.validity() + override fun visitVoid(void_: Void) = void_.validity() - override fun visitVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry - ) = voidInitiatedLedgerEntry.validity() + override fun visitVoidInitiated(voidInitiated: VoidInitiated) = + voidInitiated.validity() - override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - amendmentLedgerEntry.validity() + override fun visitAmendment(amendment: Amendment) = amendment.validity() override fun unknown(json: JsonValue?) = 0 } @@ -216,27 +188,23 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditLedgerListResponse && incrementLedgerEntry == other.incrementLedgerEntry && decrementLedgerEntry == other.decrementLedgerEntry && expirationChangeLedgerEntry == other.expirationChangeLedgerEntry && creditBlockExpiryLedgerEntry == other.creditBlockExpiryLedgerEntry && voidLedgerEntry == other.voidLedgerEntry && voidInitiatedLedgerEntry == other.voidInitiatedLedgerEntry && amendmentLedgerEntry == other.amendmentLedgerEntry /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerListResponse && increment == other.increment && decrement == other.decrement && expirationChange == other.expirationChange && creditBlockExpiry == other.creditBlockExpiry && void_ == other.void_ && voidInitiated == other.voidInitiated && amendment == other.amendment /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(incrementLedgerEntry, decrementLedgerEntry, expirationChangeLedgerEntry, creditBlockExpiryLedgerEntry, voidLedgerEntry, voidInitiatedLedgerEntry, amendmentLedgerEntry) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(increment, decrement, expirationChange, creditBlockExpiry, void_, voidInitiated, amendment) /* spotless:on */ override fun toString(): String = when { - incrementLedgerEntry != null -> - "CustomerCreditLedgerListResponse{incrementLedgerEntry=$incrementLedgerEntry}" - decrementLedgerEntry != null -> - "CustomerCreditLedgerListResponse{decrementLedgerEntry=$decrementLedgerEntry}" - expirationChangeLedgerEntry != null -> - "CustomerCreditLedgerListResponse{expirationChangeLedgerEntry=$expirationChangeLedgerEntry}" - creditBlockExpiryLedgerEntry != null -> - "CustomerCreditLedgerListResponse{creditBlockExpiryLedgerEntry=$creditBlockExpiryLedgerEntry}" - voidLedgerEntry != null -> - "CustomerCreditLedgerListResponse{voidLedgerEntry=$voidLedgerEntry}" - voidInitiatedLedgerEntry != null -> - "CustomerCreditLedgerListResponse{voidInitiatedLedgerEntry=$voidInitiatedLedgerEntry}" - amendmentLedgerEntry != null -> - "CustomerCreditLedgerListResponse{amendmentLedgerEntry=$amendmentLedgerEntry}" + increment != null -> "CustomerCreditLedgerListResponse{increment=$increment}" + decrement != null -> "CustomerCreditLedgerListResponse{decrement=$decrement}" + expirationChange != null -> + "CustomerCreditLedgerListResponse{expirationChange=$expirationChange}" + creditBlockExpiry != null -> + "CustomerCreditLedgerListResponse{creditBlockExpiry=$creditBlockExpiry}" + void_ != null -> "CustomerCreditLedgerListResponse{void_=$void_}" + voidInitiated != null -> + "CustomerCreditLedgerListResponse{voidInitiated=$voidInitiated}" + amendment != null -> "CustomerCreditLedgerListResponse{amendment=$amendment}" _json != null -> "CustomerCreditLedgerListResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid CustomerCreditLedgerListResponse") } @@ -244,40 +212,30 @@ private constructor( companion object { @JvmStatic - fun ofIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) = - CustomerCreditLedgerListResponse(incrementLedgerEntry = incrementLedgerEntry) + fun ofIncrement(increment: Increment) = + CustomerCreditLedgerListResponse(increment = increment) @JvmStatic - fun ofDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) = - CustomerCreditLedgerListResponse(decrementLedgerEntry = decrementLedgerEntry) + fun ofDecrement(decrement: Decrement) = + CustomerCreditLedgerListResponse(decrement = decrement) @JvmStatic - fun ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ) = - CustomerCreditLedgerListResponse( - expirationChangeLedgerEntry = expirationChangeLedgerEntry - ) + fun ofExpirationChange(expirationChange: ExpirationChange) = + CustomerCreditLedgerListResponse(expirationChange = expirationChange) @JvmStatic - fun ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ) = - CustomerCreditLedgerListResponse( - creditBlockExpiryLedgerEntry = creditBlockExpiryLedgerEntry - ) + fun ofCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry) = + CustomerCreditLedgerListResponse(creditBlockExpiry = creditBlockExpiry) - @JvmStatic - fun ofVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) = - CustomerCreditLedgerListResponse(voidLedgerEntry = voidLedgerEntry) + @JvmStatic fun ofVoid(void_: Void) = CustomerCreditLedgerListResponse(void_ = void_) @JvmStatic - fun ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = - CustomerCreditLedgerListResponse(voidInitiatedLedgerEntry = voidInitiatedLedgerEntry) + fun ofVoidInitiated(voidInitiated: VoidInitiated) = + CustomerCreditLedgerListResponse(voidInitiated = voidInitiated) @JvmStatic - fun ofAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) = - CustomerCreditLedgerListResponse(amendmentLedgerEntry = amendmentLedgerEntry) + fun ofAmendment(amendment: Amendment) = + CustomerCreditLedgerListResponse(amendment = amendment) } /** @@ -286,23 +244,19 @@ private constructor( */ interface Visitor { - fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry): T + fun visitIncrement(increment: Increment): T - fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry): T + fun visitDecrement(decrement: Decrement): T - fun visitExpirationChangeLedgerEntry( - expirationChangeLedgerEntry: ExpirationChangeLedgerEntry - ): T + fun visitExpirationChange(expirationChange: ExpirationChange): T - fun visitCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry - ): T + fun visitCreditBlockExpiry(creditBlockExpiry: CreditBlockExpiry): T - fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry): T + fun visitVoid(void_: Void): T - fun visitVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry): T + fun visitVoidInitiated(voidInitiated: VoidInitiated): T - fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry): T + fun visitAmendment(amendment: Amendment): T /** * Maps an unknown variant of [CustomerCreditLedgerListResponse] to a value of type [T]. @@ -330,49 +284,38 @@ private constructor( when (entryType) { "increment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListResponse(incrementLedgerEntry = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(increment = it, _json = json) } ?: CustomerCreditLedgerListResponse(_json = json) } "decrement" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListResponse(decrementLedgerEntry = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(decrement = it, _json = json) } ?: CustomerCreditLedgerListResponse(_json = json) } "expiration_change" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerListResponse( - expirationChangeLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerListResponse(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(expirationChange = it, _json = json) + } ?: CustomerCreditLedgerListResponse(_json = json) } "credit_block_expiry" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { - CustomerCreditLedgerListResponse( - creditBlockExpiryLedgerEntry = it, - _json = json, - ) - } ?: CustomerCreditLedgerListResponse(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(creditBlockExpiry = it, _json = json) + } ?: CustomerCreditLedgerListResponse(_json = json) } "void" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListResponse(voidLedgerEntry = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(void_ = it, _json = json) } ?: CustomerCreditLedgerListResponse(_json = json) } "void_initiated" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListResponse( - voidInitiatedLedgerEntry = it, - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(voidInitiated = it, _json = json) } ?: CustomerCreditLedgerListResponse(_json = json) } "amendment" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - CustomerCreditLedgerListResponse(amendmentLedgerEntry = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + CustomerCreditLedgerListResponse(amendment = it, _json = json) } ?: CustomerCreditLedgerListResponse(_json = json) } } @@ -390,26 +333,20 @@ private constructor( provider: SerializerProvider, ) { when { - value.incrementLedgerEntry != null -> - generator.writeObject(value.incrementLedgerEntry) - value.decrementLedgerEntry != null -> - generator.writeObject(value.decrementLedgerEntry) - value.expirationChangeLedgerEntry != null -> - generator.writeObject(value.expirationChangeLedgerEntry) - value.creditBlockExpiryLedgerEntry != null -> - generator.writeObject(value.creditBlockExpiryLedgerEntry) - value.voidLedgerEntry != null -> generator.writeObject(value.voidLedgerEntry) - value.voidInitiatedLedgerEntry != null -> - generator.writeObject(value.voidInitiatedLedgerEntry) - value.amendmentLedgerEntry != null -> - generator.writeObject(value.amendmentLedgerEntry) + value.increment != null -> generator.writeObject(value.increment) + value.decrement != null -> generator.writeObject(value.decrement) + value.expirationChange != null -> generator.writeObject(value.expirationChange) + value.creditBlockExpiry != null -> generator.writeObject(value.creditBlockExpiry) + value.void_ != null -> generator.writeObject(value.void_) + value.voidInitiated != null -> generator.writeObject(value.voidInitiated) + value.amendment != null -> generator.writeObject(value.amendment) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid CustomerCreditLedgerListResponse") } } } - class IncrementLedgerEntry + class Increment private constructor( private val id: JsonField, private val amount: JsonField, @@ -683,7 +620,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [IncrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Increment]. * * The following fields are required: * ```java @@ -704,7 +641,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [IncrementLedgerEntry]. */ + /** A builder for [Increment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -723,21 +660,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - id = incrementLedgerEntry.id - amount = incrementLedgerEntry.amount - createdAt = incrementLedgerEntry.createdAt - 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() + internal fun from(increment: Increment) = apply { + id = increment.id + amount = increment.amount + createdAt = increment.createdAt + creditBlock = increment.creditBlock + currency = increment.currency + customer = increment.customer + description = increment.description + endingBalance = increment.endingBalance + entryStatus = increment.entryStatus + entryType = increment.entryType + ledgerSequenceNumber = increment.ledgerSequenceNumber + metadata = increment.metadata + startingBalance = increment.startingBalance + additionalProperties = increment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -930,7 +867,7 @@ private constructor( } /** - * Returns an immutable instance of [IncrementLedgerEntry]. + * Returns an immutable instance of [Increment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -952,8 +889,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): IncrementLedgerEntry = - IncrementLedgerEntry( + fun build(): Increment = + Increment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -973,7 +910,7 @@ private constructor( private var validated: Boolean = false - fun validate(): IncrementLedgerEntry = apply { + fun validate(): Increment = apply { if (validated) { return@apply } @@ -1736,7 +1673,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Increment && 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 */ @@ -1746,10 +1683,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Increment{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}" } - class DecrementLedgerEntry + class Decrement private constructor( private val id: JsonField, private val amount: JsonField, @@ -2073,7 +2010,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [DecrementLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Decrement]. * * The following fields are required: * ```java @@ -2094,7 +2031,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DecrementLedgerEntry]. */ + /** A builder for [Decrement]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2116,24 +2053,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - id = decrementLedgerEntry.id - amount = decrementLedgerEntry.amount - createdAt = decrementLedgerEntry.createdAt - creditBlock = decrementLedgerEntry.creditBlock - currency = decrementLedgerEntry.currency - customer = decrementLedgerEntry.customer - description = decrementLedgerEntry.description - endingBalance = decrementLedgerEntry.endingBalance - entryStatus = decrementLedgerEntry.entryStatus - entryType = decrementLedgerEntry.entryType - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - metadata = decrementLedgerEntry.metadata - startingBalance = decrementLedgerEntry.startingBalance - eventId = decrementLedgerEntry.eventId - invoiceId = decrementLedgerEntry.invoiceId - priceId = decrementLedgerEntry.priceId - additionalProperties = decrementLedgerEntry.additionalProperties.toMutableMap() + internal fun from(decrement: Decrement) = apply { + id = decrement.id + amount = decrement.amount + createdAt = decrement.createdAt + creditBlock = decrement.creditBlock + currency = decrement.currency + customer = decrement.customer + description = decrement.description + endingBalance = decrement.endingBalance + entryStatus = decrement.entryStatus + entryType = decrement.entryType + ledgerSequenceNumber = decrement.ledgerSequenceNumber + metadata = decrement.metadata + startingBalance = decrement.startingBalance + eventId = decrement.eventId + invoiceId = decrement.invoiceId + priceId = decrement.priceId + additionalProperties = decrement.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2368,7 +2305,7 @@ private constructor( } /** - * Returns an immutable instance of [DecrementLedgerEntry]. + * Returns an immutable instance of [Decrement]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2390,8 +2327,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): DecrementLedgerEntry = - DecrementLedgerEntry( + fun build(): Decrement = + Decrement( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -2414,7 +2351,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DecrementLedgerEntry = apply { + fun validate(): Decrement = apply { if (validated) { return@apply } @@ -3183,7 +3120,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Decrement && 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 */ @@ -3193,10 +3130,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Decrement{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}" } - class ExpirationChangeLedgerEntry + class ExpirationChange private constructor( private val id: JsonField, private val amount: JsonField, @@ -3492,8 +3429,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [ExpirationChangeLedgerEntry]. + * Returns a mutable builder for constructing an instance of [ExpirationChange]. * * The following fields are required: * ```java @@ -3515,7 +3451,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ExpirationChangeLedgerEntry]. */ + /** A builder for [ExpirationChange]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3535,23 +3471,22 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - id = expirationChangeLedgerEntry.id - amount = expirationChangeLedgerEntry.amount - createdAt = expirationChangeLedgerEntry.createdAt - 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() + internal fun from(expirationChange: ExpirationChange) = apply { + id = expirationChange.id + amount = expirationChange.amount + createdAt = expirationChange.createdAt + creditBlock = expirationChange.creditBlock + currency = expirationChange.currency + customer = expirationChange.customer + description = expirationChange.description + endingBalance = expirationChange.endingBalance + entryStatus = expirationChange.entryStatus + entryType = expirationChange.entryType + ledgerSequenceNumber = expirationChange.ledgerSequenceNumber + metadata = expirationChange.metadata + newBlockExpiryDate = expirationChange.newBlockExpiryDate + startingBalance = expirationChange.startingBalance + additionalProperties = expirationChange.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3765,7 +3700,7 @@ private constructor( } /** - * Returns an immutable instance of [ExpirationChangeLedgerEntry]. + * Returns an immutable instance of [ExpirationChange]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3788,8 +3723,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ExpirationChangeLedgerEntry = - ExpirationChangeLedgerEntry( + fun build(): ExpirationChange = + ExpirationChange( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -3810,7 +3745,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ExpirationChangeLedgerEntry = apply { + fun validate(): ExpirationChange = apply { if (validated) { return@apply } @@ -4575,7 +4510,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ExpirationChange && 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 */ @@ -4585,10 +4520,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ExpirationChange{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}" } - class CreditBlockExpiryLedgerEntry + class CreditBlockExpiry private constructor( private val id: JsonField, private val amount: JsonField, @@ -4862,8 +4797,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CreditBlockExpiryLedgerEntry]. + * Returns a mutable builder for constructing an instance of [CreditBlockExpiry]. * * The following fields are required: * ```java @@ -4884,7 +4818,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CreditBlockExpiryLedgerEntry]. */ + /** A builder for [CreditBlockExpiry]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4903,22 +4837,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - id = creditBlockExpiryLedgerEntry.id - amount = creditBlockExpiryLedgerEntry.amount - createdAt = creditBlockExpiryLedgerEntry.createdAt - 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() + internal fun from(creditBlockExpiry: CreditBlockExpiry) = apply { + id = creditBlockExpiry.id + amount = creditBlockExpiry.amount + createdAt = creditBlockExpiry.createdAt + creditBlock = creditBlockExpiry.creditBlock + currency = creditBlockExpiry.currency + customer = creditBlockExpiry.customer + description = creditBlockExpiry.description + endingBalance = creditBlockExpiry.endingBalance + entryStatus = creditBlockExpiry.entryStatus + entryType = creditBlockExpiry.entryType + ledgerSequenceNumber = creditBlockExpiry.ledgerSequenceNumber + metadata = creditBlockExpiry.metadata + startingBalance = creditBlockExpiry.startingBalance + additionalProperties = creditBlockExpiry.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -5111,7 +5044,7 @@ private constructor( } /** - * Returns an immutable instance of [CreditBlockExpiryLedgerEntry]. + * Returns an immutable instance of [CreditBlockExpiry]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5133,8 +5066,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): CreditBlockExpiryLedgerEntry = - CreditBlockExpiryLedgerEntry( + fun build(): CreditBlockExpiry = + CreditBlockExpiry( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -5154,7 +5087,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CreditBlockExpiryLedgerEntry = apply { + fun validate(): CreditBlockExpiry = apply { if (validated) { return@apply } @@ -5917,7 +5850,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is CreditBlockExpiry && 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 */ @@ -5927,10 +5860,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "CreditBlockExpiry{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}" } - class VoidLedgerEntry + class Void private constructor( private val id: JsonField, private val amount: JsonField, @@ -6244,7 +6177,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Void]. * * The following fields are required: * ```java @@ -6267,7 +6200,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidLedgerEntry]. */ + /** A builder for [Void]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -6288,23 +6221,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - id = voidLedgerEntry.id - amount = voidLedgerEntry.amount - createdAt = voidLedgerEntry.createdAt - creditBlock = voidLedgerEntry.creditBlock - currency = voidLedgerEntry.currency - customer = voidLedgerEntry.customer - description = voidLedgerEntry.description - endingBalance = voidLedgerEntry.endingBalance - entryStatus = voidLedgerEntry.entryStatus - entryType = voidLedgerEntry.entryType - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - metadata = voidLedgerEntry.metadata - startingBalance = voidLedgerEntry.startingBalance - voidAmount = voidLedgerEntry.voidAmount - voidReason = voidLedgerEntry.voidReason - additionalProperties = voidLedgerEntry.additionalProperties.toMutableMap() + internal fun from(void_: Void) = apply { + id = void_.id + amount = void_.amount + createdAt = void_.createdAt + creditBlock = void_.creditBlock + currency = void_.currency + customer = void_.customer + description = void_.description + endingBalance = void_.endingBalance + entryStatus = void_.entryStatus + entryType = void_.entryType + ledgerSequenceNumber = void_.ledgerSequenceNumber + metadata = void_.metadata + startingBalance = void_.startingBalance + voidAmount = void_.voidAmount + voidReason = void_.voidReason + additionalProperties = void_.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -6522,7 +6455,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidLedgerEntry]. + * Returns an immutable instance of [Void]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6546,8 +6479,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidLedgerEntry = - VoidLedgerEntry( + fun build(): Void = + Void( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -6569,7 +6502,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidLedgerEntry = apply { + fun validate(): Void = apply { if (validated) { return@apply } @@ -7336,7 +7269,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Void && 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 */ @@ -7346,10 +7279,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Void{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}" } - class VoidInitiatedLedgerEntry + class VoidInitiated private constructor( private val id: JsonField, private val amount: JsonField, @@ -7685,7 +7618,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [VoidInitiatedLedgerEntry]. + * Returns a mutable builder for constructing an instance of [VoidInitiated]. * * The following fields are required: * ```java @@ -7709,7 +7642,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [VoidInitiatedLedgerEntry]. */ + /** A builder for [VoidInitiated]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -7731,24 +7664,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - id = voidInitiatedLedgerEntry.id - amount = voidInitiatedLedgerEntry.amount - createdAt = voidInitiatedLedgerEntry.createdAt - 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 - startingBalance = voidInitiatedLedgerEntry.startingBalance - voidAmount = voidInitiatedLedgerEntry.voidAmount - voidReason = voidInitiatedLedgerEntry.voidReason - additionalProperties = voidInitiatedLedgerEntry.additionalProperties.toMutableMap() + internal fun from(voidInitiated: VoidInitiated) = apply { + id = voidInitiated.id + amount = voidInitiated.amount + createdAt = voidInitiated.createdAt + creditBlock = voidInitiated.creditBlock + currency = voidInitiated.currency + customer = voidInitiated.customer + description = voidInitiated.description + endingBalance = voidInitiated.endingBalance + entryStatus = voidInitiated.entryStatus + entryType = voidInitiated.entryType + ledgerSequenceNumber = voidInitiated.ledgerSequenceNumber + metadata = voidInitiated.metadata + newBlockExpiryDate = voidInitiated.newBlockExpiryDate + startingBalance = voidInitiated.startingBalance + voidAmount = voidInitiated.voidAmount + voidReason = voidInitiated.voidReason + additionalProperties = voidInitiated.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -7980,7 +7913,7 @@ private constructor( } /** - * Returns an immutable instance of [VoidInitiatedLedgerEntry]. + * Returns an immutable instance of [VoidInitiated]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8005,8 +7938,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): VoidInitiatedLedgerEntry = - VoidInitiatedLedgerEntry( + fun build(): VoidInitiated = + VoidInitiated( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -8029,7 +7962,7 @@ private constructor( private var validated: Boolean = false - fun validate(): VoidInitiatedLedgerEntry = apply { + fun validate(): VoidInitiated = apply { if (validated) { return@apply } @@ -8798,7 +8731,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is VoidInitiated && 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 */ @@ -8808,10 +8741,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "VoidInitiated{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}" } - class AmendmentLedgerEntry + class Amendment private constructor( private val id: JsonField, private val amount: JsonField, @@ -9085,7 +9018,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [AmendmentLedgerEntry]. + * Returns a mutable builder for constructing an instance of [Amendment]. * * The following fields are required: * ```java @@ -9106,7 +9039,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmendmentLedgerEntry]. */ + /** A builder for [Amendment]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9125,21 +9058,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - id = amendmentLedgerEntry.id - amount = amendmentLedgerEntry.amount - createdAt = amendmentLedgerEntry.createdAt - 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() + internal fun from(amendment: Amendment) = apply { + id = amendment.id + amount = amendment.amount + createdAt = amendment.createdAt + creditBlock = amendment.creditBlock + currency = amendment.currency + customer = amendment.customer + description = amendment.description + endingBalance = amendment.endingBalance + entryStatus = amendment.entryStatus + entryType = amendment.entryType + ledgerSequenceNumber = amendment.ledgerSequenceNumber + metadata = amendment.metadata + startingBalance = amendment.startingBalance + additionalProperties = amendment.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9332,7 +9265,7 @@ private constructor( } /** - * Returns an immutable instance of [AmendmentLedgerEntry]. + * Returns an immutable instance of [Amendment]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9354,8 +9287,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmendmentLedgerEntry = - AmendmentLedgerEntry( + fun build(): Amendment = + Amendment( checkRequired("id", id), checkRequired("amount", amount), checkRequired("createdAt", createdAt), @@ -9375,7 +9308,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmendmentLedgerEntry = apply { + fun validate(): Amendment = apply { if (validated) { return@apply } @@ -10138,7 +10071,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amendment && 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 */ @@ -10148,6 +10081,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Amendment{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/CustomerUpdateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt index 762713da6..4eafe89a2 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 @@ -813,40 +813,38 @@ private constructor( body.taxConfiguration(taxConfiguration) } - /** - * Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewAvalara(newAvalara)`. - */ - fun taxConfiguration(newAvalara: TaxConfiguration.NewAvalaraTaxConfiguration) = apply { - body.taxConfiguration(newAvalara) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofAvalara(avalara)`. */ + fun taxConfiguration(avalara: TaxConfiguration.Avalara) = apply { + body.taxConfiguration(avalara) } /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewAvalaraTaxConfiguration.builder() + * TaxConfiguration.Avalara.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newAvalaraTaxConfiguration(taxExempt: Boolean) = apply { - body.newAvalaraTaxConfiguration(taxExempt) + fun avalaraTaxConfiguration(taxExempt: Boolean) = apply { + body.avalaraTaxConfiguration(taxExempt) } - /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewTaxJar(newTaxJar)`. */ - fun taxConfiguration(newTaxJar: TaxConfiguration.NewTaxJarConfiguration) = apply { - body.taxConfiguration(newTaxJar) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofTaxjar(taxjar)`. */ + fun taxConfiguration(taxjar: TaxConfiguration.Taxjar) = apply { + body.taxConfiguration(taxjar) } /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewTaxJarConfiguration.builder() + * TaxConfiguration.Taxjar.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newTaxJarTaxConfiguration(taxExempt: Boolean) = apply { - body.newTaxJarTaxConfiguration(taxExempt) + fun taxjarTaxConfiguration(taxExempt: Boolean) = apply { + body.taxjarTaxConfiguration(taxExempt) } /** @@ -2016,46 +2014,35 @@ private constructor( this.taxConfiguration = taxConfiguration } - /** - * Alias for calling [taxConfiguration] with - * `TaxConfiguration.ofNewAvalara(newAvalara)`. - */ - fun taxConfiguration(newAvalara: TaxConfiguration.NewAvalaraTaxConfiguration) = - taxConfiguration(TaxConfiguration.ofNewAvalara(newAvalara)) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofAvalara(avalara)`. */ + fun taxConfiguration(avalara: TaxConfiguration.Avalara) = + taxConfiguration(TaxConfiguration.ofAvalara(avalara)) /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewAvalaraTaxConfiguration.builder() + * TaxConfiguration.Avalara.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newAvalaraTaxConfiguration(taxExempt: Boolean) = - taxConfiguration( - TaxConfiguration.NewAvalaraTaxConfiguration.builder() - .taxExempt(taxExempt) - .build() - ) + fun avalaraTaxConfiguration(taxExempt: Boolean) = + taxConfiguration(TaxConfiguration.Avalara.builder().taxExempt(taxExempt).build()) - /** - * Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewTaxJar(newTaxJar)`. - */ - fun taxConfiguration(newTaxJar: TaxConfiguration.NewTaxJarConfiguration) = - taxConfiguration(TaxConfiguration.ofNewTaxJar(newTaxJar)) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofTaxjar(taxjar)`. */ + fun taxConfiguration(taxjar: TaxConfiguration.Taxjar) = + taxConfiguration(TaxConfiguration.ofTaxjar(taxjar)) /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewTaxJarConfiguration.builder() + * TaxConfiguration.Taxjar.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newTaxJarTaxConfiguration(taxExempt: Boolean) = - taxConfiguration( - TaxConfiguration.NewTaxJarConfiguration.builder().taxExempt(taxExempt).build() - ) + fun taxjarTaxConfiguration(taxExempt: Boolean) = + taxConfiguration(TaxConfiguration.Taxjar.builder().taxExempt(taxExempt).build()) /** * Tax IDs are commonly required to be displayed on customer invoices, which are added @@ -4017,29 +4004,29 @@ private constructor( @JsonSerialize(using = TaxConfiguration.Serializer::class) class TaxConfiguration private constructor( - private val newAvalara: NewAvalaraTaxConfiguration? = null, - private val newTaxJar: NewTaxJarConfiguration? = null, + private val avalara: Avalara? = null, + private val taxjar: Taxjar? = null, private val _json: JsonValue? = null, ) { - fun newAvalara(): Optional = Optional.ofNullable(newAvalara) + fun avalara(): Optional = Optional.ofNullable(avalara) - fun newTaxJar(): Optional = Optional.ofNullable(newTaxJar) + fun taxjar(): Optional = Optional.ofNullable(taxjar) - fun isNewAvalara(): Boolean = newAvalara != null + fun isAvalara(): Boolean = avalara != null - fun isNewTaxJar(): Boolean = newTaxJar != null + fun isTaxjar(): Boolean = taxjar != null - fun asNewAvalara(): NewAvalaraTaxConfiguration = newAvalara.getOrThrow("newAvalara") + fun asAvalara(): Avalara = avalara.getOrThrow("avalara") - fun asNewTaxJar(): NewTaxJarConfiguration = newTaxJar.getOrThrow("newTaxJar") + fun asTaxjar(): Taxjar = taxjar.getOrThrow("taxjar") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newAvalara != null -> visitor.visitNewAvalara(newAvalara) - newTaxJar != null -> visitor.visitNewTaxJar(newTaxJar) + avalara != null -> visitor.visitAvalara(avalara) + taxjar != null -> visitor.visitTaxjar(taxjar) else -> visitor.unknown(_json) } @@ -4052,12 +4039,12 @@ private constructor( accept( object : Visitor { - override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) { - newAvalara.validate() + override fun visitAvalara(avalara: Avalara) { + avalara.validate() } - override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) { - newTaxJar.validate() + override fun visitTaxjar(taxjar: Taxjar) { + taxjar.validate() } } ) @@ -4082,11 +4069,9 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) = - newAvalara.validity() + override fun visitAvalara(avalara: Avalara) = avalara.validity() - override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) = - newTaxJar.validity() + override fun visitTaxjar(taxjar: Taxjar) = taxjar.validity() override fun unknown(json: JsonValue?) = 0 } @@ -4097,28 +4082,24 @@ private constructor( return true } - return /* spotless:off */ other is TaxConfiguration && newAvalara == other.newAvalara && newTaxJar == other.newTaxJar /* spotless:on */ + return /* spotless:off */ other is TaxConfiguration && avalara == other.avalara && taxjar == other.taxjar /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newAvalara, newTaxJar) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(avalara, taxjar) /* spotless:on */ override fun toString(): String = when { - newAvalara != null -> "TaxConfiguration{newAvalara=$newAvalara}" - newTaxJar != null -> "TaxConfiguration{newTaxJar=$newTaxJar}" + avalara != null -> "TaxConfiguration{avalara=$avalara}" + taxjar != null -> "TaxConfiguration{taxjar=$taxjar}" _json != null -> "TaxConfiguration{_unknown=$_json}" else -> throw IllegalStateException("Invalid TaxConfiguration") } companion object { - @JvmStatic - fun ofNewAvalara(newAvalara: NewAvalaraTaxConfiguration) = - TaxConfiguration(newAvalara = newAvalara) + @JvmStatic fun ofAvalara(avalara: Avalara) = TaxConfiguration(avalara = avalara) - @JvmStatic - fun ofNewTaxJar(newTaxJar: NewTaxJarConfiguration) = - TaxConfiguration(newTaxJar = newTaxJar) + @JvmStatic fun ofTaxjar(taxjar: Taxjar) = TaxConfiguration(taxjar = taxjar) } /** @@ -4127,9 +4108,9 @@ private constructor( */ interface Visitor { - fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration): T + fun visitAvalara(avalara: Avalara): T - fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration): T + fun visitTaxjar(taxjar: Taxjar): T /** * Maps an unknown variant of [TaxConfiguration] to a value of type [T]. @@ -4155,13 +4136,13 @@ private constructor( when (taxProvider) { "avalara" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { TaxConfiguration(newAvalara = it, _json = json) } - ?: TaxConfiguration(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + TaxConfiguration(avalara = it, _json = json) + } ?: TaxConfiguration(_json = json) } "taxjar" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - TaxConfiguration(newTaxJar = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + TaxConfiguration(taxjar = it, _json = json) } ?: TaxConfiguration(_json = json) } } @@ -4178,15 +4159,15 @@ private constructor( provider: SerializerProvider, ) { when { - value.newAvalara != null -> generator.writeObject(value.newAvalara) - value.newTaxJar != null -> generator.writeObject(value.newTaxJar) + value.avalara != null -> generator.writeObject(value.avalara) + value.taxjar != null -> generator.writeObject(value.taxjar) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid TaxConfiguration") } } } - class NewAvalaraTaxConfiguration + class Avalara private constructor( private val taxExempt: JsonField, private val taxProvider: JsonValue, @@ -4269,8 +4250,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAvalaraTaxConfiguration]. + * Returns a mutable builder for constructing an instance of [Avalara]. * * The following fields are required: * ```java @@ -4280,7 +4260,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAvalaraTaxConfiguration]. */ + /** A builder for [Avalara]. */ class Builder internal constructor() { private var taxExempt: JsonField? = null @@ -4289,12 +4269,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAvalaraTaxConfiguration: NewAvalaraTaxConfiguration) = apply { - taxExempt = newAvalaraTaxConfiguration.taxExempt - taxProvider = newAvalaraTaxConfiguration.taxProvider - taxExemptionCode = newAvalaraTaxConfiguration.taxExemptionCode - additionalProperties = - newAvalaraTaxConfiguration.additionalProperties.toMutableMap() + internal fun from(avalara: Avalara) = apply { + taxExempt = avalara.taxExempt + taxProvider = avalara.taxProvider + taxExemptionCode = avalara.taxExemptionCode + additionalProperties = avalara.additionalProperties.toMutableMap() } fun taxExempt(taxExempt: Boolean) = taxExempt(JsonField.of(taxExempt)) @@ -4366,7 +4345,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAvalaraTaxConfiguration]. + * Returns an immutable instance of [Avalara]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4377,8 +4356,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAvalaraTaxConfiguration = - NewAvalaraTaxConfiguration( + fun build(): Avalara = + Avalara( checkRequired("taxExempt", taxExempt), taxProvider, taxExemptionCode, @@ -4388,7 +4367,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAvalaraTaxConfiguration = apply { + fun validate(): Avalara = apply { if (validated) { return@apply } @@ -4428,7 +4407,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAvalaraTaxConfiguration && taxExempt == other.taxExempt && taxProvider == other.taxProvider && taxExemptionCode == other.taxExemptionCode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Avalara && taxExempt == other.taxExempt && taxProvider == other.taxProvider && taxExemptionCode == other.taxExemptionCode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4438,10 +4417,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAvalaraTaxConfiguration{taxExempt=$taxExempt, taxProvider=$taxProvider, taxExemptionCode=$taxExemptionCode, additionalProperties=$additionalProperties}" + "Avalara{taxExempt=$taxExempt, taxProvider=$taxProvider, taxExemptionCode=$taxExemptionCode, additionalProperties=$additionalProperties}" } - class NewTaxJarConfiguration + class Taxjar private constructor( private val taxExempt: JsonField, private val taxProvider: JsonValue, @@ -4503,8 +4482,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewTaxJarConfiguration]. + * Returns a mutable builder for constructing an instance of [Taxjar]. * * The following fields are required: * ```java @@ -4514,7 +4492,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewTaxJarConfiguration]. */ + /** A builder for [Taxjar]. */ class Builder internal constructor() { private var taxExempt: JsonField? = null @@ -4522,11 +4500,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newTaxJarConfiguration: NewTaxJarConfiguration) = apply { - taxExempt = newTaxJarConfiguration.taxExempt - taxProvider = newTaxJarConfiguration.taxProvider - additionalProperties = - newTaxJarConfiguration.additionalProperties.toMutableMap() + internal fun from(taxjar: Taxjar) = apply { + taxExempt = taxjar.taxExempt + taxProvider = taxjar.taxProvider + additionalProperties = taxjar.additionalProperties.toMutableMap() } fun taxExempt(taxExempt: Boolean) = taxExempt(JsonField.of(taxExempt)) @@ -4577,7 +4554,7 @@ private constructor( } /** - * Returns an immutable instance of [NewTaxJarConfiguration]. + * Returns an immutable instance of [Taxjar]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4588,8 +4565,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewTaxJarConfiguration = - NewTaxJarConfiguration( + fun build(): Taxjar = + Taxjar( checkRequired("taxExempt", taxExempt), taxProvider, additionalProperties.toMutableMap(), @@ -4598,7 +4575,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewTaxJarConfiguration = apply { + fun validate(): Taxjar = apply { if (validated) { return@apply } @@ -4636,7 +4613,7 @@ private constructor( return true } - return /* spotless:off */ other is NewTaxJarConfiguration && taxExempt == other.taxExempt && taxProvider == other.taxProvider && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Taxjar && taxExempt == other.taxExempt && taxProvider == other.taxProvider && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4646,7 +4623,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewTaxJarConfiguration{taxExempt=$taxExempt, taxProvider=$taxProvider, additionalProperties=$additionalProperties}" + "Taxjar{taxExempt=$taxExempt, taxProvider=$taxProvider, additionalProperties=$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 9dc6e1e6f..f109905b7 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 @@ -809,40 +809,38 @@ private constructor( body.taxConfiguration(taxConfiguration) } - /** - * Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewAvalara(newAvalara)`. - */ - fun taxConfiguration(newAvalara: TaxConfiguration.NewAvalaraTaxConfiguration) = apply { - body.taxConfiguration(newAvalara) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofAvalara(avalara)`. */ + fun taxConfiguration(avalara: TaxConfiguration.Avalara) = apply { + body.taxConfiguration(avalara) } /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewAvalaraTaxConfiguration.builder() + * TaxConfiguration.Avalara.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newAvalaraTaxConfiguration(taxExempt: Boolean) = apply { - body.newAvalaraTaxConfiguration(taxExempt) + fun avalaraTaxConfiguration(taxExempt: Boolean) = apply { + body.avalaraTaxConfiguration(taxExempt) } - /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewTaxJar(newTaxJar)`. */ - fun taxConfiguration(newTaxJar: TaxConfiguration.NewTaxJarConfiguration) = apply { - body.taxConfiguration(newTaxJar) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofTaxjar(taxjar)`. */ + fun taxConfiguration(taxjar: TaxConfiguration.Taxjar) = apply { + body.taxConfiguration(taxjar) } /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewTaxJarConfiguration.builder() + * TaxConfiguration.Taxjar.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newTaxJarTaxConfiguration(taxExempt: Boolean) = apply { - body.newTaxJarTaxConfiguration(taxExempt) + fun taxjarTaxConfiguration(taxExempt: Boolean) = apply { + body.taxjarTaxConfiguration(taxExempt) } /** @@ -2012,46 +2010,35 @@ private constructor( this.taxConfiguration = taxConfiguration } - /** - * Alias for calling [taxConfiguration] with - * `TaxConfiguration.ofNewAvalara(newAvalara)`. - */ - fun taxConfiguration(newAvalara: TaxConfiguration.NewAvalaraTaxConfiguration) = - taxConfiguration(TaxConfiguration.ofNewAvalara(newAvalara)) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofAvalara(avalara)`. */ + fun taxConfiguration(avalara: TaxConfiguration.Avalara) = + taxConfiguration(TaxConfiguration.ofAvalara(avalara)) /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewAvalaraTaxConfiguration.builder() + * TaxConfiguration.Avalara.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newAvalaraTaxConfiguration(taxExempt: Boolean) = - taxConfiguration( - TaxConfiguration.NewAvalaraTaxConfiguration.builder() - .taxExempt(taxExempt) - .build() - ) + fun avalaraTaxConfiguration(taxExempt: Boolean) = + taxConfiguration(TaxConfiguration.Avalara.builder().taxExempt(taxExempt).build()) - /** - * Alias for calling [taxConfiguration] with `TaxConfiguration.ofNewTaxJar(newTaxJar)`. - */ - fun taxConfiguration(newTaxJar: TaxConfiguration.NewTaxJarConfiguration) = - taxConfiguration(TaxConfiguration.ofNewTaxJar(newTaxJar)) + /** Alias for calling [taxConfiguration] with `TaxConfiguration.ofTaxjar(taxjar)`. */ + fun taxConfiguration(taxjar: TaxConfiguration.Taxjar) = + taxConfiguration(TaxConfiguration.ofTaxjar(taxjar)) /** * Alias for calling [taxConfiguration] with the following: * ```java - * TaxConfiguration.NewTaxJarConfiguration.builder() + * TaxConfiguration.Taxjar.builder() * .taxExempt(taxExempt) * .build() * ``` */ - fun newTaxJarTaxConfiguration(taxExempt: Boolean) = - taxConfiguration( - TaxConfiguration.NewTaxJarConfiguration.builder().taxExempt(taxExempt).build() - ) + fun taxjarTaxConfiguration(taxExempt: Boolean) = + taxConfiguration(TaxConfiguration.Taxjar.builder().taxExempt(taxExempt).build()) /** * Tax IDs are commonly required to be displayed on customer invoices, which are added @@ -4013,29 +4000,29 @@ private constructor( @JsonSerialize(using = TaxConfiguration.Serializer::class) class TaxConfiguration private constructor( - private val newAvalara: NewAvalaraTaxConfiguration? = null, - private val newTaxJar: NewTaxJarConfiguration? = null, + private val avalara: Avalara? = null, + private val taxjar: Taxjar? = null, private val _json: JsonValue? = null, ) { - fun newAvalara(): Optional = Optional.ofNullable(newAvalara) + fun avalara(): Optional = Optional.ofNullable(avalara) - fun newTaxJar(): Optional = Optional.ofNullable(newTaxJar) + fun taxjar(): Optional = Optional.ofNullable(taxjar) - fun isNewAvalara(): Boolean = newAvalara != null + fun isAvalara(): Boolean = avalara != null - fun isNewTaxJar(): Boolean = newTaxJar != null + fun isTaxjar(): Boolean = taxjar != null - fun asNewAvalara(): NewAvalaraTaxConfiguration = newAvalara.getOrThrow("newAvalara") + fun asAvalara(): Avalara = avalara.getOrThrow("avalara") - fun asNewTaxJar(): NewTaxJarConfiguration = newTaxJar.getOrThrow("newTaxJar") + fun asTaxjar(): Taxjar = taxjar.getOrThrow("taxjar") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newAvalara != null -> visitor.visitNewAvalara(newAvalara) - newTaxJar != null -> visitor.visitNewTaxJar(newTaxJar) + avalara != null -> visitor.visitAvalara(avalara) + taxjar != null -> visitor.visitTaxjar(taxjar) else -> visitor.unknown(_json) } @@ -4048,12 +4035,12 @@ private constructor( accept( object : Visitor { - override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) { - newAvalara.validate() + override fun visitAvalara(avalara: Avalara) { + avalara.validate() } - override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) { - newTaxJar.validate() + override fun visitTaxjar(taxjar: Taxjar) { + taxjar.validate() } } ) @@ -4078,11 +4065,9 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) = - newAvalara.validity() + override fun visitAvalara(avalara: Avalara) = avalara.validity() - override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) = - newTaxJar.validity() + override fun visitTaxjar(taxjar: Taxjar) = taxjar.validity() override fun unknown(json: JsonValue?) = 0 } @@ -4093,28 +4078,24 @@ private constructor( return true } - return /* spotless:off */ other is TaxConfiguration && newAvalara == other.newAvalara && newTaxJar == other.newTaxJar /* spotless:on */ + return /* spotless:off */ other is TaxConfiguration && avalara == other.avalara && taxjar == other.taxjar /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newAvalara, newTaxJar) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(avalara, taxjar) /* spotless:on */ override fun toString(): String = when { - newAvalara != null -> "TaxConfiguration{newAvalara=$newAvalara}" - newTaxJar != null -> "TaxConfiguration{newTaxJar=$newTaxJar}" + avalara != null -> "TaxConfiguration{avalara=$avalara}" + taxjar != null -> "TaxConfiguration{taxjar=$taxjar}" _json != null -> "TaxConfiguration{_unknown=$_json}" else -> throw IllegalStateException("Invalid TaxConfiguration") } companion object { - @JvmStatic - fun ofNewAvalara(newAvalara: NewAvalaraTaxConfiguration) = - TaxConfiguration(newAvalara = newAvalara) + @JvmStatic fun ofAvalara(avalara: Avalara) = TaxConfiguration(avalara = avalara) - @JvmStatic - fun ofNewTaxJar(newTaxJar: NewTaxJarConfiguration) = - TaxConfiguration(newTaxJar = newTaxJar) + @JvmStatic fun ofTaxjar(taxjar: Taxjar) = TaxConfiguration(taxjar = taxjar) } /** @@ -4123,9 +4104,9 @@ private constructor( */ interface Visitor { - fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration): T + fun visitAvalara(avalara: Avalara): T - fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration): T + fun visitTaxjar(taxjar: Taxjar): T /** * Maps an unknown variant of [TaxConfiguration] to a value of type [T]. @@ -4151,13 +4132,13 @@ private constructor( when (taxProvider) { "avalara" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { TaxConfiguration(newAvalara = it, _json = json) } - ?: TaxConfiguration(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + TaxConfiguration(avalara = it, _json = json) + } ?: TaxConfiguration(_json = json) } "taxjar" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - TaxConfiguration(newTaxJar = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + TaxConfiguration(taxjar = it, _json = json) } ?: TaxConfiguration(_json = json) } } @@ -4174,15 +4155,15 @@ private constructor( provider: SerializerProvider, ) { when { - value.newAvalara != null -> generator.writeObject(value.newAvalara) - value.newTaxJar != null -> generator.writeObject(value.newTaxJar) + value.avalara != null -> generator.writeObject(value.avalara) + value.taxjar != null -> generator.writeObject(value.taxjar) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid TaxConfiguration") } } } - class NewAvalaraTaxConfiguration + class Avalara private constructor( private val taxExempt: JsonField, private val taxProvider: JsonValue, @@ -4265,8 +4246,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAvalaraTaxConfiguration]. + * Returns a mutable builder for constructing an instance of [Avalara]. * * The following fields are required: * ```java @@ -4276,7 +4256,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAvalaraTaxConfiguration]. */ + /** A builder for [Avalara]. */ class Builder internal constructor() { private var taxExempt: JsonField? = null @@ -4285,12 +4265,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAvalaraTaxConfiguration: NewAvalaraTaxConfiguration) = apply { - taxExempt = newAvalaraTaxConfiguration.taxExempt - taxProvider = newAvalaraTaxConfiguration.taxProvider - taxExemptionCode = newAvalaraTaxConfiguration.taxExemptionCode - additionalProperties = - newAvalaraTaxConfiguration.additionalProperties.toMutableMap() + internal fun from(avalara: Avalara) = apply { + taxExempt = avalara.taxExempt + taxProvider = avalara.taxProvider + taxExemptionCode = avalara.taxExemptionCode + additionalProperties = avalara.additionalProperties.toMutableMap() } fun taxExempt(taxExempt: Boolean) = taxExempt(JsonField.of(taxExempt)) @@ -4362,7 +4341,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAvalaraTaxConfiguration]. + * Returns an immutable instance of [Avalara]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4373,8 +4352,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAvalaraTaxConfiguration = - NewAvalaraTaxConfiguration( + fun build(): Avalara = + Avalara( checkRequired("taxExempt", taxExempt), taxProvider, taxExemptionCode, @@ -4384,7 +4363,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAvalaraTaxConfiguration = apply { + fun validate(): Avalara = apply { if (validated) { return@apply } @@ -4424,7 +4403,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAvalaraTaxConfiguration && taxExempt == other.taxExempt && taxProvider == other.taxProvider && taxExemptionCode == other.taxExemptionCode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Avalara && taxExempt == other.taxExempt && taxProvider == other.taxProvider && taxExemptionCode == other.taxExemptionCode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4434,10 +4413,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAvalaraTaxConfiguration{taxExempt=$taxExempt, taxProvider=$taxProvider, taxExemptionCode=$taxExemptionCode, additionalProperties=$additionalProperties}" + "Avalara{taxExempt=$taxExempt, taxProvider=$taxProvider, taxExemptionCode=$taxExemptionCode, additionalProperties=$additionalProperties}" } - class NewTaxJarConfiguration + class Taxjar private constructor( private val taxExempt: JsonField, private val taxProvider: JsonValue, @@ -4499,8 +4478,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewTaxJarConfiguration]. + * Returns a mutable builder for constructing an instance of [Taxjar]. * * The following fields are required: * ```java @@ -4510,7 +4488,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewTaxJarConfiguration]. */ + /** A builder for [Taxjar]. */ class Builder internal constructor() { private var taxExempt: JsonField? = null @@ -4518,11 +4496,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newTaxJarConfiguration: NewTaxJarConfiguration) = apply { - taxExempt = newTaxJarConfiguration.taxExempt - taxProvider = newTaxJarConfiguration.taxProvider - additionalProperties = - newTaxJarConfiguration.additionalProperties.toMutableMap() + internal fun from(taxjar: Taxjar) = apply { + taxExempt = taxjar.taxExempt + taxProvider = taxjar.taxProvider + additionalProperties = taxjar.additionalProperties.toMutableMap() } fun taxExempt(taxExempt: Boolean) = taxExempt(JsonField.of(taxExempt)) @@ -4573,7 +4550,7 @@ private constructor( } /** - * Returns an immutable instance of [NewTaxJarConfiguration]. + * Returns an immutable instance of [Taxjar]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4584,8 +4561,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewTaxJarConfiguration = - NewTaxJarConfiguration( + fun build(): Taxjar = + Taxjar( checkRequired("taxExempt", taxExempt), taxProvider, additionalProperties.toMutableMap(), @@ -4594,7 +4571,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewTaxJarConfiguration = apply { + fun validate(): Taxjar = apply { if (validated) { return@apply } @@ -4632,7 +4609,7 @@ private constructor( return true } - return /* spotless:off */ other is NewTaxJarConfiguration && taxExempt == other.taxExempt && taxProvider == other.taxProvider && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Taxjar && taxExempt == other.taxExempt && taxProvider == other.taxProvider && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4642,7 +4619,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewTaxJarConfiguration{taxExempt=$taxExempt, taxProvider=$taxProvider, additionalProperties=$additionalProperties}" + "Taxjar{taxExempt=$taxExempt, taxProvider=$taxProvider, additionalProperties=$additionalProperties}" } } 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 34b049694..71e7ab8a8 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 @@ -6885,40 +6885,31 @@ private constructor( } /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryUsageDiscount(monetaryUsageDiscount)`. + * Alias for calling [addAdjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ - fun addAdjustment(monetaryUsageDiscount: Adjustment.MonetaryUsageDiscountAdjustment) = - addAdjustment(Adjustment.ofMonetaryUsageDiscount(monetaryUsageDiscount)) + fun addAdjustment(usageDiscount: Adjustment.UsageDiscount) = + addAdjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryAmountDiscount(monetaryAmountDiscount)`. + * Alias for calling [addAdjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun addAdjustment(monetaryAmountDiscount: Adjustment.MonetaryAmountDiscountAdjustment) = - addAdjustment(Adjustment.ofMonetaryAmountDiscount(monetaryAmountDiscount)) + fun addAdjustment(amountDiscount: Adjustment.AmountDiscount) = + addAdjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryPercentageDiscount(monetaryPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun addAdjustment( - monetaryPercentageDiscount: Adjustment.MonetaryPercentageDiscountAdjustment - ) = addAdjustment(Adjustment.ofMonetaryPercentageDiscount(monetaryPercentageDiscount)) + fun addAdjustment(percentageDiscount: Adjustment.PercentageDiscount) = + addAdjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryMinimum(monetaryMinimum)`. - */ - fun addAdjustment(monetaryMinimum: Adjustment.MonetaryMinimumAdjustment) = - addAdjustment(Adjustment.ofMonetaryMinimum(monetaryMinimum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun addAdjustment(minimum: Adjustment.Minimum) = + addAdjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryMaximum(monetaryMaximum)`. - */ - fun addAdjustment(monetaryMaximum: Adjustment.MonetaryMaximumAdjustment) = - addAdjustment(Adjustment.ofMonetaryMaximum(monetaryMaximum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun addAdjustment(maximum: Adjustment.Maximum) = + addAdjustment(Adjustment.ofMaximum(maximum)) /** * The final amount for a line item after all adjustments and pre paid credits have been @@ -7174,142 +7165,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** Either the fixed fee quantity or the usage during the service period. */ @@ -7369,16 +7360,14 @@ private constructor( } /** Alias for calling [addSubLineItem] with `SubLineItem.ofMatrix(matrix)`. */ - fun addSubLineItem(matrix: SubLineItem.MatrixSubLineItem) = + fun addSubLineItem(matrix: SubLineItem.Matrix) = addSubLineItem(SubLineItem.ofMatrix(matrix)) /** Alias for calling [addSubLineItem] with `SubLineItem.ofTier(tier)`. */ - fun addSubLineItem(tier: SubLineItem.TierSubLineItem) = - addSubLineItem(SubLineItem.ofTier(tier)) + fun addSubLineItem(tier: SubLineItem.Tier) = addSubLineItem(SubLineItem.ofTier(tier)) - /** Alias for calling [addSubLineItem] with `SubLineItem.ofOther(other)`. */ - fun addSubLineItem(other: SubLineItem.OtherSubLineItem) = - addSubLineItem(SubLineItem.ofOther(other)) + /** Alias for calling [addSubLineItem] with `SubLineItem.ofNull(null_)`. */ + fun addSubLineItem(null_: SubLineItem.Null) = addSubLineItem(SubLineItem.ofNull(null_)) /** The line amount before before any adjustments. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) @@ -7609,66 +7598,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val monetaryUsageDiscount: MonetaryUsageDiscountAdjustment? = null, - private val monetaryAmountDiscount: MonetaryAmountDiscountAdjustment? = null, - private val monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment? = null, - private val monetaryMinimum: MonetaryMinimumAdjustment? = null, - private val monetaryMaximum: MonetaryMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun monetaryUsageDiscount(): Optional = - Optional.ofNullable(monetaryUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun monetaryAmountDiscount(): Optional = - Optional.ofNullable(monetaryAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun monetaryPercentageDiscount(): Optional = - Optional.ofNullable(monetaryPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun monetaryMinimum(): Optional = - Optional.ofNullable(monetaryMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun monetaryMaximum(): Optional = - Optional.ofNullable(monetaryMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isMonetaryUsageDiscount(): Boolean = monetaryUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isMonetaryAmountDiscount(): Boolean = monetaryAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isMonetaryPercentageDiscount(): Boolean = monetaryPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isMonetaryMinimum(): Boolean = monetaryMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isMonetaryMaximum(): Boolean = monetaryMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asMonetaryUsageDiscount(): MonetaryUsageDiscountAdjustment = - monetaryUsageDiscount.getOrThrow("monetaryUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asMonetaryAmountDiscount(): MonetaryAmountDiscountAdjustment = - monetaryAmountDiscount.getOrThrow("monetaryAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asMonetaryPercentageDiscount(): MonetaryPercentageDiscountAdjustment = - monetaryPercentageDiscount.getOrThrow("monetaryPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asMonetaryMinimum(): MonetaryMinimumAdjustment = - monetaryMinimum.getOrThrow("monetaryMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asMonetaryMaximum(): MonetaryMaximumAdjustment = - monetaryMaximum.getOrThrow("monetaryMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - monetaryUsageDiscount != null -> - visitor.visitMonetaryUsageDiscount(monetaryUsageDiscount) - monetaryAmountDiscount != null -> - visitor.visitMonetaryAmountDiscount(monetaryAmountDiscount) - monetaryPercentageDiscount != null -> - visitor.visitMonetaryPercentageDiscount(monetaryPercentageDiscount) - monetaryMinimum != null -> visitor.visitMonetaryMinimum(monetaryMinimum) - monetaryMaximum != null -> visitor.visitMonetaryMaximum(monetaryMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -7681,34 +7660,26 @@ private constructor( accept( object : Visitor { - override fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) { - monetaryUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) { - monetaryAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - monetaryPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitMonetaryMinimum( - monetaryMinimum: MonetaryMinimumAdjustment - ) { - monetaryMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitMonetaryMaximum( - monetaryMaximum: MonetaryMaximumAdjustment - ) { - monetaryMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -7733,25 +7704,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) = monetaryUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) = monetaryAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) = monetaryPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitMonetaryMinimum( - monetaryMinimum: MonetaryMinimumAdjustment - ) = monetaryMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitMonetaryMaximum( - monetaryMaximum: MonetaryMaximumAdjustment - ) = monetaryMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -7762,21 +7727,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && monetaryUsageDiscount == other.monetaryUsageDiscount && monetaryAmountDiscount == other.monetaryAmountDiscount && monetaryPercentageDiscount == other.monetaryPercentageDiscount && monetaryMinimum == other.monetaryMinimum && monetaryMaximum == other.monetaryMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(monetaryUsageDiscount, monetaryAmountDiscount, monetaryPercentageDiscount, monetaryMinimum, monetaryMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - monetaryUsageDiscount != null -> - "Adjustment{monetaryUsageDiscount=$monetaryUsageDiscount}" - monetaryAmountDiscount != null -> - "Adjustment{monetaryAmountDiscount=$monetaryAmountDiscount}" - monetaryPercentageDiscount != null -> - "Adjustment{monetaryPercentageDiscount=$monetaryPercentageDiscount}" - monetaryMinimum != null -> "Adjustment{monetaryMinimum=$monetaryMinimum}" - monetaryMaximum != null -> "Adjustment{monetaryMaximum=$monetaryMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -7784,27 +7747,20 @@ private constructor( companion object { @JvmStatic - fun ofMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) = Adjustment(monetaryUsageDiscount = monetaryUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) = Adjustment(monetaryAmountDiscount = monetaryAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) = Adjustment(monetaryPercentageDiscount = monetaryPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment) = - Adjustment(monetaryMinimum = monetaryMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment) = - Adjustment(monetaryMaximum = monetaryMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -7813,21 +7769,15 @@ private constructor( */ interface Visitor { - fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -7853,38 +7803,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(monetaryMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(monetaryMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -7900,23 +7841,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.monetaryUsageDiscount != null -> - generator.writeObject(value.monetaryUsageDiscount) - value.monetaryAmountDiscount != null -> - generator.writeObject(value.monetaryAmountDiscount) - value.monetaryPercentageDiscount != null -> - generator.writeObject(value.monetaryPercentageDiscount) - value.monetaryMinimum != null -> - generator.writeObject(value.monetaryMinimum) - value.monetaryMaximum != null -> - generator.writeObject(value.monetaryMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class MonetaryUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -8095,8 +8032,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -8111,7 +8047,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -8124,21 +8060,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryUsageDiscountAdjustment: MonetaryUsageDiscountAdjustment - ) = apply { - id = monetaryUsageDiscountAdjustment.id - adjustmentType = monetaryUsageDiscountAdjustment.adjustmentType - amount = monetaryUsageDiscountAdjustment.amount + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType + amount = usageDiscount.amount appliesToPriceIds = - monetaryUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryUsageDiscountAdjustment.isInvoiceLevel - reason = monetaryUsageDiscountAdjustment.reason - usageDiscount = monetaryUsageDiscountAdjustment.usageDiscount - additionalProperties = - monetaryUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -8281,7 +8212,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8297,8 +8228,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryUsageDiscountAdjustment = - MonetaryUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -8314,7 +8245,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -8366,7 +8297,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -8376,10 +8307,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class MonetaryAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -8558,8 +8489,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -8574,7 +8504,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -8587,21 +8517,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryAmountDiscountAdjustment: MonetaryAmountDiscountAdjustment - ) = apply { - id = monetaryAmountDiscountAdjustment.id - adjustmentType = monetaryAmountDiscountAdjustment.adjustmentType - amount = monetaryAmountDiscountAdjustment.amount - amountDiscount = monetaryAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + amount = amountDiscount.amount + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - monetaryAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryAmountDiscountAdjustment.isInvoiceLevel - reason = monetaryAmountDiscountAdjustment.reason - additionalProperties = - monetaryAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -8744,7 +8669,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8760,8 +8685,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryAmountDiscountAdjustment = - MonetaryAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -8777,7 +8702,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -8829,7 +8754,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -8839,10 +8764,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryPercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -9023,7 +8948,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [MonetaryPercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -9038,7 +8963,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryPercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9051,21 +8976,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryPercentageDiscountAdjustment: MonetaryPercentageDiscountAdjustment - ) = apply { - id = monetaryPercentageDiscountAdjustment.id - adjustmentType = monetaryPercentageDiscountAdjustment.adjustmentType - amount = monetaryPercentageDiscountAdjustment.amount + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType + amount = percentageDiscount.amount appliesToPriceIds = - monetaryPercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryPercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = monetaryPercentageDiscountAdjustment.percentageDiscount - reason = monetaryPercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + reason = percentageDiscount.reason additionalProperties = - monetaryPercentageDiscountAdjustment.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9208,7 +9129,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryPercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9224,8 +9145,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryPercentageDiscountAdjustment = - MonetaryPercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -9241,7 +9162,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryPercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -9293,7 +9214,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -9303,10 +9224,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -9507,8 +9428,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -9524,7 +9444,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9538,22 +9458,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(monetaryMinimumAdjustment: MonetaryMinimumAdjustment) = - apply { - id = monetaryMinimumAdjustment.id - adjustmentType = monetaryMinimumAdjustment.adjustmentType - amount = monetaryMinimumAdjustment.amount - appliesToPriceIds = - monetaryMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryMinimumAdjustment.isInvoiceLevel - itemId = monetaryMinimumAdjustment.itemId - minimumAmount = monetaryMinimumAdjustment.minimumAmount - reason = monetaryMinimumAdjustment.reason - additionalProperties = - monetaryMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + amount = minimum.amount + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -9707,7 +9622,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9724,8 +9639,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryMinimumAdjustment = - MonetaryMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -9742,7 +9657,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -9794,7 +9709,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -9804,10 +9719,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -9986,8 +9901,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -10002,7 +9916,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -10015,21 +9929,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(monetaryMaximumAdjustment: MonetaryMaximumAdjustment) = - apply { - id = monetaryMaximumAdjustment.id - adjustmentType = monetaryMaximumAdjustment.adjustmentType - amount = monetaryMaximumAdjustment.amount - appliesToPriceIds = - monetaryMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryMaximumAdjustment.isInvoiceLevel - maximumAmount = monetaryMaximumAdjustment.maximumAmount - reason = monetaryMaximumAdjustment.reason - additionalProperties = - monetaryMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + amount = maximum.amount + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -10171,7 +10080,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -10187,8 +10096,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryMaximumAdjustment = - MonetaryMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -10204,7 +10113,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -10254,7 +10163,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -10264,7 +10173,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -10748,29 +10657,29 @@ private constructor( @JsonSerialize(using = SubLineItem.Serializer::class) class SubLineItem private constructor( - private val matrix: MatrixSubLineItem? = null, - private val tier: TierSubLineItem? = null, - private val other: OtherSubLineItem? = null, + private val matrix: Matrix? = null, + private val tier: Tier? = null, + private val null_: Null? = null, private val _json: JsonValue? = null, ) { - fun matrix(): Optional = Optional.ofNullable(matrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun tier(): Optional = Optional.ofNullable(tier) + fun tier(): Optional = Optional.ofNullable(tier) - fun other(): Optional = Optional.ofNullable(other) + fun null_(): Optional = Optional.ofNullable(null_) fun isMatrix(): Boolean = matrix != null fun isTier(): Boolean = tier != null - fun isOther(): Boolean = other != null + fun isNull(): Boolean = null_ != null - fun asMatrix(): MatrixSubLineItem = matrix.getOrThrow("matrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asTier(): TierSubLineItem = tier.getOrThrow("tier") + fun asTier(): Tier = tier.getOrThrow("tier") - fun asOther(): OtherSubLineItem = other.getOrThrow("other") + fun asNull(): Null = null_.getOrThrow("null_") fun _json(): Optional = Optional.ofNullable(_json) @@ -10778,7 +10687,7 @@ private constructor( when { matrix != null -> visitor.visitMatrix(matrix) tier != null -> visitor.visitTier(tier) - other != null -> visitor.visitOther(other) + null_ != null -> visitor.visitNull(null_) else -> visitor.unknown(_json) } @@ -10791,16 +10700,16 @@ private constructor( accept( object : Visitor { - override fun visitMatrix(matrix: MatrixSubLineItem) { + override fun visitMatrix(matrix: Matrix) { matrix.validate() } - override fun visitTier(tier: TierSubLineItem) { + override fun visitTier(tier: Tier) { tier.validate() } - override fun visitOther(other: OtherSubLineItem) { - other.validate() + override fun visitNull(null_: Null) { + null_.validate() } } ) @@ -10825,11 +10734,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitMatrix(matrix: MatrixSubLineItem) = matrix.validity() + override fun visitMatrix(matrix: Matrix) = matrix.validity() - override fun visitTier(tier: TierSubLineItem) = tier.validity() + override fun visitTier(tier: Tier) = tier.validity() - override fun visitOther(other: OtherSubLineItem) = other.validity() + override fun visitNull(null_: Null) = null_.validity() override fun unknown(json: JsonValue?) = 0 } @@ -10840,27 +10749,27 @@ private constructor( return true } - return /* spotless:off */ other is SubLineItem && matrix == other.matrix && tier == other.tier && this.other == other.other /* spotless:on */ + return /* spotless:off */ other is SubLineItem && matrix == other.matrix && tier == other.tier && null_ == other.null_ /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(matrix, tier, other) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(matrix, tier, null_) /* spotless:on */ override fun toString(): String = when { matrix != null -> "SubLineItem{matrix=$matrix}" tier != null -> "SubLineItem{tier=$tier}" - other != null -> "SubLineItem{other=$other}" + null_ != null -> "SubLineItem{null_=$null_}" _json != null -> "SubLineItem{_unknown=$_json}" else -> throw IllegalStateException("Invalid SubLineItem") } companion object { - @JvmStatic fun ofMatrix(matrix: MatrixSubLineItem) = SubLineItem(matrix = matrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = SubLineItem(matrix = matrix) - @JvmStatic fun ofTier(tier: TierSubLineItem) = SubLineItem(tier = tier) + @JvmStatic fun ofTier(tier: Tier) = SubLineItem(tier = tier) - @JvmStatic fun ofOther(other: OtherSubLineItem) = SubLineItem(other = other) + @JvmStatic fun ofNull(null_: Null) = SubLineItem(null_ = null_) } /** @@ -10869,11 +10778,11 @@ private constructor( */ interface Visitor { - fun visitMatrix(matrix: MatrixSubLineItem): T + fun visitMatrix(matrix: Matrix): T - fun visitTier(tier: TierSubLineItem): T + fun visitTier(tier: Tier): T - fun visitOther(other: OtherSubLineItem): T + fun visitNull(null_: Null): T /** * Maps an unknown variant of [SubLineItem] to a value of type [T]. @@ -10898,18 +10807,18 @@ private constructor( when (type) { "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { SubLineItem(matrix = it, _json = json) } ?: SubLineItem(_json = json) } "tier" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { SubLineItem(tier = it, _json = json) } ?: SubLineItem(_json = json) } "'null'" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - SubLineItem(other = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + SubLineItem(null_ = it, _json = json) } ?: SubLineItem(_json = json) } } @@ -10928,14 +10837,14 @@ private constructor( when { value.matrix != null -> generator.writeObject(value.matrix) value.tier != null -> generator.writeObject(value.tier) - value.other != null -> generator.writeObject(value.other) + value.null_ != null -> generator.writeObject(value.null_) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid SubLineItem") } } } - class MatrixSubLineItem + class Matrix private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -11074,8 +10983,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MatrixSubLineItem]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -11089,7 +10997,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixSubLineItem]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -11101,14 +11009,14 @@ private constructor( 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 - type = matrixSubLineItem.type - additionalProperties = matrixSubLineItem.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + amount = matrix.amount + grouping = matrix.grouping + matrixConfig = matrix.matrixConfig + name = matrix.name + quantity = matrix.quantity + type = matrix.type + additionalProperties = matrix.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -11210,7 +11118,7 @@ private constructor( } /** - * Returns an immutable instance of [MatrixSubLineItem]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11225,8 +11133,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MatrixSubLineItem = - MatrixSubLineItem( + fun build(): Matrix = + Matrix( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("matrixConfig", matrixConfig), @@ -11239,7 +11147,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixSubLineItem = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -11684,7 +11592,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -11694,10 +11602,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MatrixSubLineItem{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" + "Matrix{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } - class TierSubLineItem + class Tier private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -11836,7 +11744,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TierSubLineItem]. + * Returns a mutable builder for constructing an instance of [Tier]. * * The following fields are required: * ```java @@ -11850,7 +11758,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TierSubLineItem]. */ + /** A builder for [Tier]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -11862,14 +11770,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tierSubLineItem: TierSubLineItem) = apply { - amount = tierSubLineItem.amount - grouping = tierSubLineItem.grouping - name = tierSubLineItem.name - quantity = tierSubLineItem.quantity - tierConfig = tierSubLineItem.tierConfig - type = tierSubLineItem.type - additionalProperties = tierSubLineItem.additionalProperties.toMutableMap() + internal fun from(tier: Tier) = apply { + amount = tier.amount + grouping = tier.grouping + name = tier.name + quantity = tier.quantity + tierConfig = tier.tierConfig + type = tier.type + additionalProperties = tier.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -11970,7 +11878,7 @@ private constructor( } /** - * Returns an immutable instance of [TierSubLineItem]. + * Returns an immutable instance of [Tier]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11985,8 +11893,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TierSubLineItem = - TierSubLineItem( + fun build(): Tier = + Tier( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("name", name), @@ -11999,7 +11907,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TierSubLineItem = apply { + fun validate(): Tier = apply { if (validated) { return@apply } @@ -12512,7 +12420,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tier && 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 */ @@ -12522,10 +12430,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "TierSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" + "Tier{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" } - class OtherSubLineItem + class Null private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -12643,7 +12551,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [OtherSubLineItem]. + * Returns a mutable builder for constructing an instance of [Null]. * * The following fields are required: * ```java @@ -12656,7 +12564,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [OtherSubLineItem]. */ + /** A builder for [Null]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -12667,13 +12575,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(otherSubLineItem: OtherSubLineItem) = apply { - amount = otherSubLineItem.amount - grouping = otherSubLineItem.grouping - name = otherSubLineItem.name - quantity = otherSubLineItem.quantity - type = otherSubLineItem.type - additionalProperties = otherSubLineItem.additionalProperties.toMutableMap() + internal fun from(null_: Null) = apply { + amount = null_.amount + grouping = null_.grouping + name = null_.name + quantity = null_.quantity + type = null_.type + additionalProperties = null_.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -12761,7 +12669,7 @@ private constructor( } /** - * Returns an immutable instance of [OtherSubLineItem]. + * Returns an immutable instance of [Null]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -12775,8 +12683,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): OtherSubLineItem = - OtherSubLineItem( + fun build(): Null = + Null( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("name", name), @@ -12788,7 +12696,7 @@ private constructor( private var validated: Boolean = false - fun validate(): OtherSubLineItem = apply { + fun validate(): Null = apply { if (validated) { return@apply } @@ -13039,7 +12947,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Null && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -13049,7 +12957,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "OtherSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" + "Null{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, 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 3855cd15c..67dcc5929 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 @@ -6876,40 +6876,31 @@ private constructor( } /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryUsageDiscount(monetaryUsageDiscount)`. + * Alias for calling [addAdjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ - fun addAdjustment(monetaryUsageDiscount: Adjustment.MonetaryUsageDiscountAdjustment) = - addAdjustment(Adjustment.ofMonetaryUsageDiscount(monetaryUsageDiscount)) + fun addAdjustment(usageDiscount: Adjustment.UsageDiscount) = + addAdjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryAmountDiscount(monetaryAmountDiscount)`. + * Alias for calling [addAdjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun addAdjustment(monetaryAmountDiscount: Adjustment.MonetaryAmountDiscountAdjustment) = - addAdjustment(Adjustment.ofMonetaryAmountDiscount(monetaryAmountDiscount)) + fun addAdjustment(amountDiscount: Adjustment.AmountDiscount) = + addAdjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryPercentageDiscount(monetaryPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun addAdjustment( - monetaryPercentageDiscount: Adjustment.MonetaryPercentageDiscountAdjustment - ) = addAdjustment(Adjustment.ofMonetaryPercentageDiscount(monetaryPercentageDiscount)) + fun addAdjustment(percentageDiscount: Adjustment.PercentageDiscount) = + addAdjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryMinimum(monetaryMinimum)`. - */ - fun addAdjustment(monetaryMinimum: Adjustment.MonetaryMinimumAdjustment) = - addAdjustment(Adjustment.ofMonetaryMinimum(monetaryMinimum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun addAdjustment(minimum: Adjustment.Minimum) = + addAdjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryMaximum(monetaryMaximum)`. - */ - fun addAdjustment(monetaryMaximum: Adjustment.MonetaryMaximumAdjustment) = - addAdjustment(Adjustment.ofMonetaryMaximum(monetaryMaximum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun addAdjustment(maximum: Adjustment.Maximum) = + addAdjustment(Adjustment.ofMaximum(maximum)) /** * The final amount for a line item after all adjustments and pre paid credits have been @@ -7165,142 +7156,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** Either the fixed fee quantity or the usage during the service period. */ @@ -7360,16 +7351,14 @@ private constructor( } /** Alias for calling [addSubLineItem] with `SubLineItem.ofMatrix(matrix)`. */ - fun addSubLineItem(matrix: SubLineItem.MatrixSubLineItem) = + fun addSubLineItem(matrix: SubLineItem.Matrix) = addSubLineItem(SubLineItem.ofMatrix(matrix)) /** Alias for calling [addSubLineItem] with `SubLineItem.ofTier(tier)`. */ - fun addSubLineItem(tier: SubLineItem.TierSubLineItem) = - addSubLineItem(SubLineItem.ofTier(tier)) + fun addSubLineItem(tier: SubLineItem.Tier) = addSubLineItem(SubLineItem.ofTier(tier)) - /** Alias for calling [addSubLineItem] with `SubLineItem.ofOther(other)`. */ - fun addSubLineItem(other: SubLineItem.OtherSubLineItem) = - addSubLineItem(SubLineItem.ofOther(other)) + /** Alias for calling [addSubLineItem] with `SubLineItem.ofNull(null_)`. */ + fun addSubLineItem(null_: SubLineItem.Null) = addSubLineItem(SubLineItem.ofNull(null_)) /** The line amount before before any adjustments. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) @@ -7600,66 +7589,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val monetaryUsageDiscount: MonetaryUsageDiscountAdjustment? = null, - private val monetaryAmountDiscount: MonetaryAmountDiscountAdjustment? = null, - private val monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment? = null, - private val monetaryMinimum: MonetaryMinimumAdjustment? = null, - private val monetaryMaximum: MonetaryMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun monetaryUsageDiscount(): Optional = - Optional.ofNullable(monetaryUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun monetaryAmountDiscount(): Optional = - Optional.ofNullable(monetaryAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun monetaryPercentageDiscount(): Optional = - Optional.ofNullable(monetaryPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun monetaryMinimum(): Optional = - Optional.ofNullable(monetaryMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun monetaryMaximum(): Optional = - Optional.ofNullable(monetaryMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isMonetaryUsageDiscount(): Boolean = monetaryUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isMonetaryAmountDiscount(): Boolean = monetaryAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isMonetaryPercentageDiscount(): Boolean = monetaryPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isMonetaryMinimum(): Boolean = monetaryMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isMonetaryMaximum(): Boolean = monetaryMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asMonetaryUsageDiscount(): MonetaryUsageDiscountAdjustment = - monetaryUsageDiscount.getOrThrow("monetaryUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asMonetaryAmountDiscount(): MonetaryAmountDiscountAdjustment = - monetaryAmountDiscount.getOrThrow("monetaryAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asMonetaryPercentageDiscount(): MonetaryPercentageDiscountAdjustment = - monetaryPercentageDiscount.getOrThrow("monetaryPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asMonetaryMinimum(): MonetaryMinimumAdjustment = - monetaryMinimum.getOrThrow("monetaryMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asMonetaryMaximum(): MonetaryMaximumAdjustment = - monetaryMaximum.getOrThrow("monetaryMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - monetaryUsageDiscount != null -> - visitor.visitMonetaryUsageDiscount(monetaryUsageDiscount) - monetaryAmountDiscount != null -> - visitor.visitMonetaryAmountDiscount(monetaryAmountDiscount) - monetaryPercentageDiscount != null -> - visitor.visitMonetaryPercentageDiscount(monetaryPercentageDiscount) - monetaryMinimum != null -> visitor.visitMonetaryMinimum(monetaryMinimum) - monetaryMaximum != null -> visitor.visitMonetaryMaximum(monetaryMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -7672,34 +7651,26 @@ private constructor( accept( object : Visitor { - override fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) { - monetaryUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) { - monetaryAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - monetaryPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitMonetaryMinimum( - monetaryMinimum: MonetaryMinimumAdjustment - ) { - monetaryMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitMonetaryMaximum( - monetaryMaximum: MonetaryMaximumAdjustment - ) { - monetaryMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -7724,25 +7695,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) = monetaryUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) = monetaryAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) = monetaryPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitMonetaryMinimum( - monetaryMinimum: MonetaryMinimumAdjustment - ) = monetaryMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitMonetaryMaximum( - monetaryMaximum: MonetaryMaximumAdjustment - ) = monetaryMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -7753,21 +7718,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && monetaryUsageDiscount == other.monetaryUsageDiscount && monetaryAmountDiscount == other.monetaryAmountDiscount && monetaryPercentageDiscount == other.monetaryPercentageDiscount && monetaryMinimum == other.monetaryMinimum && monetaryMaximum == other.monetaryMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(monetaryUsageDiscount, monetaryAmountDiscount, monetaryPercentageDiscount, monetaryMinimum, monetaryMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - monetaryUsageDiscount != null -> - "Adjustment{monetaryUsageDiscount=$monetaryUsageDiscount}" - monetaryAmountDiscount != null -> - "Adjustment{monetaryAmountDiscount=$monetaryAmountDiscount}" - monetaryPercentageDiscount != null -> - "Adjustment{monetaryPercentageDiscount=$monetaryPercentageDiscount}" - monetaryMinimum != null -> "Adjustment{monetaryMinimum=$monetaryMinimum}" - monetaryMaximum != null -> "Adjustment{monetaryMaximum=$monetaryMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -7775,27 +7738,20 @@ private constructor( companion object { @JvmStatic - fun ofMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) = Adjustment(monetaryUsageDiscount = monetaryUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) = Adjustment(monetaryAmountDiscount = monetaryAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) = Adjustment(monetaryPercentageDiscount = monetaryPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment) = - Adjustment(monetaryMinimum = monetaryMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment) = - Adjustment(monetaryMaximum = monetaryMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -7804,21 +7760,15 @@ private constructor( */ interface Visitor { - fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -7844,38 +7794,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(monetaryMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(monetaryMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -7891,23 +7832,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.monetaryUsageDiscount != null -> - generator.writeObject(value.monetaryUsageDiscount) - value.monetaryAmountDiscount != null -> - generator.writeObject(value.monetaryAmountDiscount) - value.monetaryPercentageDiscount != null -> - generator.writeObject(value.monetaryPercentageDiscount) - value.monetaryMinimum != null -> - generator.writeObject(value.monetaryMinimum) - value.monetaryMaximum != null -> - generator.writeObject(value.monetaryMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class MonetaryUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -8086,8 +8023,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -8102,7 +8038,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -8115,21 +8051,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryUsageDiscountAdjustment: MonetaryUsageDiscountAdjustment - ) = apply { - id = monetaryUsageDiscountAdjustment.id - adjustmentType = monetaryUsageDiscountAdjustment.adjustmentType - amount = monetaryUsageDiscountAdjustment.amount + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType + amount = usageDiscount.amount appliesToPriceIds = - monetaryUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryUsageDiscountAdjustment.isInvoiceLevel - reason = monetaryUsageDiscountAdjustment.reason - usageDiscount = monetaryUsageDiscountAdjustment.usageDiscount - additionalProperties = - monetaryUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -8272,7 +8203,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8288,8 +8219,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryUsageDiscountAdjustment = - MonetaryUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -8305,7 +8236,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -8357,7 +8288,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -8367,10 +8298,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class MonetaryAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -8549,8 +8480,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -8565,7 +8495,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -8578,21 +8508,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryAmountDiscountAdjustment: MonetaryAmountDiscountAdjustment - ) = apply { - id = monetaryAmountDiscountAdjustment.id - adjustmentType = monetaryAmountDiscountAdjustment.adjustmentType - amount = monetaryAmountDiscountAdjustment.amount - amountDiscount = monetaryAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + amount = amountDiscount.amount + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - monetaryAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryAmountDiscountAdjustment.isInvoiceLevel - reason = monetaryAmountDiscountAdjustment.reason - additionalProperties = - monetaryAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -8735,7 +8660,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8751,8 +8676,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryAmountDiscountAdjustment = - MonetaryAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -8768,7 +8693,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -8820,7 +8745,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -8830,10 +8755,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryPercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -9014,7 +8939,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [MonetaryPercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -9029,7 +8954,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryPercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9042,21 +8967,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryPercentageDiscountAdjustment: MonetaryPercentageDiscountAdjustment - ) = apply { - id = monetaryPercentageDiscountAdjustment.id - adjustmentType = monetaryPercentageDiscountAdjustment.adjustmentType - amount = monetaryPercentageDiscountAdjustment.amount + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType + amount = percentageDiscount.amount appliesToPriceIds = - monetaryPercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryPercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = monetaryPercentageDiscountAdjustment.percentageDiscount - reason = monetaryPercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + reason = percentageDiscount.reason additionalProperties = - monetaryPercentageDiscountAdjustment.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9199,7 +9120,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryPercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9215,8 +9136,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryPercentageDiscountAdjustment = - MonetaryPercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -9232,7 +9153,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryPercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -9284,7 +9205,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -9294,10 +9215,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -9498,8 +9419,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -9515,7 +9435,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9529,22 +9449,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(monetaryMinimumAdjustment: MonetaryMinimumAdjustment) = - apply { - id = monetaryMinimumAdjustment.id - adjustmentType = monetaryMinimumAdjustment.adjustmentType - amount = monetaryMinimumAdjustment.amount - appliesToPriceIds = - monetaryMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryMinimumAdjustment.isInvoiceLevel - itemId = monetaryMinimumAdjustment.itemId - minimumAmount = monetaryMinimumAdjustment.minimumAmount - reason = monetaryMinimumAdjustment.reason - additionalProperties = - monetaryMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + amount = minimum.amount + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -9698,7 +9613,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9715,8 +9630,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryMinimumAdjustment = - MonetaryMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -9733,7 +9648,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -9785,7 +9700,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -9795,10 +9710,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -9977,8 +9892,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -9993,7 +9907,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -10006,21 +9920,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(monetaryMaximumAdjustment: MonetaryMaximumAdjustment) = - apply { - id = monetaryMaximumAdjustment.id - adjustmentType = monetaryMaximumAdjustment.adjustmentType - amount = monetaryMaximumAdjustment.amount - appliesToPriceIds = - monetaryMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryMaximumAdjustment.isInvoiceLevel - maximumAmount = monetaryMaximumAdjustment.maximumAmount - reason = monetaryMaximumAdjustment.reason - additionalProperties = - monetaryMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + amount = maximum.amount + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -10162,7 +10071,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -10178,8 +10087,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryMaximumAdjustment = - MonetaryMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -10195,7 +10104,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -10245,7 +10154,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -10255,7 +10164,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -10739,29 +10648,29 @@ private constructor( @JsonSerialize(using = SubLineItem.Serializer::class) class SubLineItem private constructor( - private val matrix: MatrixSubLineItem? = null, - private val tier: TierSubLineItem? = null, - private val other: OtherSubLineItem? = null, + private val matrix: Matrix? = null, + private val tier: Tier? = null, + private val null_: Null? = null, private val _json: JsonValue? = null, ) { - fun matrix(): Optional = Optional.ofNullable(matrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun tier(): Optional = Optional.ofNullable(tier) + fun tier(): Optional = Optional.ofNullable(tier) - fun other(): Optional = Optional.ofNullable(other) + fun null_(): Optional = Optional.ofNullable(null_) fun isMatrix(): Boolean = matrix != null fun isTier(): Boolean = tier != null - fun isOther(): Boolean = other != null + fun isNull(): Boolean = null_ != null - fun asMatrix(): MatrixSubLineItem = matrix.getOrThrow("matrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asTier(): TierSubLineItem = tier.getOrThrow("tier") + fun asTier(): Tier = tier.getOrThrow("tier") - fun asOther(): OtherSubLineItem = other.getOrThrow("other") + fun asNull(): Null = null_.getOrThrow("null_") fun _json(): Optional = Optional.ofNullable(_json) @@ -10769,7 +10678,7 @@ private constructor( when { matrix != null -> visitor.visitMatrix(matrix) tier != null -> visitor.visitTier(tier) - other != null -> visitor.visitOther(other) + null_ != null -> visitor.visitNull(null_) else -> visitor.unknown(_json) } @@ -10782,16 +10691,16 @@ private constructor( accept( object : Visitor { - override fun visitMatrix(matrix: MatrixSubLineItem) { + override fun visitMatrix(matrix: Matrix) { matrix.validate() } - override fun visitTier(tier: TierSubLineItem) { + override fun visitTier(tier: Tier) { tier.validate() } - override fun visitOther(other: OtherSubLineItem) { - other.validate() + override fun visitNull(null_: Null) { + null_.validate() } } ) @@ -10816,11 +10725,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitMatrix(matrix: MatrixSubLineItem) = matrix.validity() + override fun visitMatrix(matrix: Matrix) = matrix.validity() - override fun visitTier(tier: TierSubLineItem) = tier.validity() + override fun visitTier(tier: Tier) = tier.validity() - override fun visitOther(other: OtherSubLineItem) = other.validity() + override fun visitNull(null_: Null) = null_.validity() override fun unknown(json: JsonValue?) = 0 } @@ -10831,27 +10740,27 @@ private constructor( return true } - return /* spotless:off */ other is SubLineItem && matrix == other.matrix && tier == other.tier && this.other == other.other /* spotless:on */ + return /* spotless:off */ other is SubLineItem && matrix == other.matrix && tier == other.tier && null_ == other.null_ /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(matrix, tier, other) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(matrix, tier, null_) /* spotless:on */ override fun toString(): String = when { matrix != null -> "SubLineItem{matrix=$matrix}" tier != null -> "SubLineItem{tier=$tier}" - other != null -> "SubLineItem{other=$other}" + null_ != null -> "SubLineItem{null_=$null_}" _json != null -> "SubLineItem{_unknown=$_json}" else -> throw IllegalStateException("Invalid SubLineItem") } companion object { - @JvmStatic fun ofMatrix(matrix: MatrixSubLineItem) = SubLineItem(matrix = matrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = SubLineItem(matrix = matrix) - @JvmStatic fun ofTier(tier: TierSubLineItem) = SubLineItem(tier = tier) + @JvmStatic fun ofTier(tier: Tier) = SubLineItem(tier = tier) - @JvmStatic fun ofOther(other: OtherSubLineItem) = SubLineItem(other = other) + @JvmStatic fun ofNull(null_: Null) = SubLineItem(null_ = null_) } /** @@ -10860,11 +10769,11 @@ private constructor( */ interface Visitor { - fun visitMatrix(matrix: MatrixSubLineItem): T + fun visitMatrix(matrix: Matrix): T - fun visitTier(tier: TierSubLineItem): T + fun visitTier(tier: Tier): T - fun visitOther(other: OtherSubLineItem): T + fun visitNull(null_: Null): T /** * Maps an unknown variant of [SubLineItem] to a value of type [T]. @@ -10889,18 +10798,18 @@ private constructor( when (type) { "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { SubLineItem(matrix = it, _json = json) } ?: SubLineItem(_json = json) } "tier" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { SubLineItem(tier = it, _json = json) } ?: SubLineItem(_json = json) } "'null'" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - SubLineItem(other = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + SubLineItem(null_ = it, _json = json) } ?: SubLineItem(_json = json) } } @@ -10919,14 +10828,14 @@ private constructor( when { value.matrix != null -> generator.writeObject(value.matrix) value.tier != null -> generator.writeObject(value.tier) - value.other != null -> generator.writeObject(value.other) + value.null_ != null -> generator.writeObject(value.null_) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid SubLineItem") } } } - class MatrixSubLineItem + class Matrix private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -11065,8 +10974,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MatrixSubLineItem]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -11080,7 +10988,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixSubLineItem]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -11092,14 +11000,14 @@ private constructor( 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 - type = matrixSubLineItem.type - additionalProperties = matrixSubLineItem.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + amount = matrix.amount + grouping = matrix.grouping + matrixConfig = matrix.matrixConfig + name = matrix.name + quantity = matrix.quantity + type = matrix.type + additionalProperties = matrix.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -11201,7 +11109,7 @@ private constructor( } /** - * Returns an immutable instance of [MatrixSubLineItem]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11216,8 +11124,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MatrixSubLineItem = - MatrixSubLineItem( + fun build(): Matrix = + Matrix( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("matrixConfig", matrixConfig), @@ -11230,7 +11138,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixSubLineItem = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -11675,7 +11583,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -11685,10 +11593,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MatrixSubLineItem{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" + "Matrix{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } - class TierSubLineItem + class Tier private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -11827,7 +11735,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TierSubLineItem]. + * Returns a mutable builder for constructing an instance of [Tier]. * * The following fields are required: * ```java @@ -11841,7 +11749,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TierSubLineItem]. */ + /** A builder for [Tier]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -11853,14 +11761,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tierSubLineItem: TierSubLineItem) = apply { - amount = tierSubLineItem.amount - grouping = tierSubLineItem.grouping - name = tierSubLineItem.name - quantity = tierSubLineItem.quantity - tierConfig = tierSubLineItem.tierConfig - type = tierSubLineItem.type - additionalProperties = tierSubLineItem.additionalProperties.toMutableMap() + internal fun from(tier: Tier) = apply { + amount = tier.amount + grouping = tier.grouping + name = tier.name + quantity = tier.quantity + tierConfig = tier.tierConfig + type = tier.type + additionalProperties = tier.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -11961,7 +11869,7 @@ private constructor( } /** - * Returns an immutable instance of [TierSubLineItem]. + * Returns an immutable instance of [Tier]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11976,8 +11884,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TierSubLineItem = - TierSubLineItem( + fun build(): Tier = + Tier( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("name", name), @@ -11990,7 +11898,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TierSubLineItem = apply { + fun validate(): Tier = apply { if (validated) { return@apply } @@ -12503,7 +12411,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tier && 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 */ @@ -12513,10 +12421,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "TierSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" + "Tier{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" } - class OtherSubLineItem + class Null private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -12634,7 +12542,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [OtherSubLineItem]. + * Returns a mutable builder for constructing an instance of [Null]. * * The following fields are required: * ```java @@ -12647,7 +12555,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [OtherSubLineItem]. */ + /** A builder for [Null]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -12658,13 +12566,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(otherSubLineItem: OtherSubLineItem) = apply { - amount = otherSubLineItem.amount - grouping = otherSubLineItem.grouping - name = otherSubLineItem.name - quantity = otherSubLineItem.quantity - type = otherSubLineItem.type - additionalProperties = otherSubLineItem.additionalProperties.toMutableMap() + internal fun from(null_: Null) = apply { + amount = null_.amount + grouping = null_.grouping + name = null_.name + quantity = null_.quantity + type = null_.type + additionalProperties = null_.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -12752,7 +12660,7 @@ private constructor( } /** - * Returns an immutable instance of [OtherSubLineItem]. + * Returns an immutable instance of [Null]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -12766,8 +12674,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): OtherSubLineItem = - OtherSubLineItem( + fun build(): Null = + Null( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("name", name), @@ -12779,7 +12687,7 @@ private constructor( private var validated: Boolean = false - fun validate(): OtherSubLineItem = apply { + fun validate(): Null = apply { if (validated) { return@apply } @@ -13030,7 +12938,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Null && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -13040,7 +12948,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "OtherSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" + "Null{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } } 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 750003fd1..f90c5e0cb 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 @@ -669,39 +669,28 @@ private constructor( } } - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryUsageDiscount(monetaryUsageDiscount)`. - */ - fun addAdjustment(monetaryUsageDiscount: Adjustment.MonetaryUsageDiscountAdjustment) = - addAdjustment(Adjustment.ofMonetaryUsageDiscount(monetaryUsageDiscount)) + /** Alias for calling [addAdjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun addAdjustment(usageDiscount: Adjustment.UsageDiscount) = + addAdjustment(Adjustment.ofUsageDiscount(usageDiscount)) - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryAmountDiscount(monetaryAmountDiscount)`. - */ - fun addAdjustment(monetaryAmountDiscount: Adjustment.MonetaryAmountDiscountAdjustment) = - addAdjustment(Adjustment.ofMonetaryAmountDiscount(monetaryAmountDiscount)) + /** Alias for calling [addAdjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ + fun addAdjustment(amountDiscount: Adjustment.AmountDiscount) = + addAdjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [addAdjustment] with - * `Adjustment.ofMonetaryPercentageDiscount(monetaryPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun addAdjustment( - monetaryPercentageDiscount: Adjustment.MonetaryPercentageDiscountAdjustment - ) = addAdjustment(Adjustment.ofMonetaryPercentageDiscount(monetaryPercentageDiscount)) + fun addAdjustment(percentageDiscount: Adjustment.PercentageDiscount) = + addAdjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [addAdjustment] with `Adjustment.ofMonetaryMinimum(monetaryMinimum)`. - */ - fun addAdjustment(monetaryMinimum: Adjustment.MonetaryMinimumAdjustment) = - addAdjustment(Adjustment.ofMonetaryMinimum(monetaryMinimum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun addAdjustment(minimum: Adjustment.Minimum) = + addAdjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [addAdjustment] with `Adjustment.ofMonetaryMaximum(monetaryMaximum)`. - */ - fun addAdjustment(monetaryMaximum: Adjustment.MonetaryMaximumAdjustment) = - addAdjustment(Adjustment.ofMonetaryMaximum(monetaryMaximum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun addAdjustment(maximum: Adjustment.Maximum) = + addAdjustment(Adjustment.ofMaximum(maximum)) /** * The final amount for a line item after all adjustments and pre paid credits have been @@ -948,130 +937,128 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = - price(Price.ofTieredPackage(tieredPackage)) + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = - price(Price.ofGroupedTiered(groupedTiered)) + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** Either the fixed fee quantity or the usage during the service period. */ @@ -1127,16 +1114,14 @@ private constructor( } /** Alias for calling [addSubLineItem] with `SubLineItem.ofMatrix(matrix)`. */ - fun addSubLineItem(matrix: SubLineItem.MatrixSubLineItem) = + fun addSubLineItem(matrix: SubLineItem.Matrix) = addSubLineItem(SubLineItem.ofMatrix(matrix)) /** Alias for calling [addSubLineItem] with `SubLineItem.ofTier(tier)`. */ - fun addSubLineItem(tier: SubLineItem.TierSubLineItem) = - addSubLineItem(SubLineItem.ofTier(tier)) + fun addSubLineItem(tier: SubLineItem.Tier) = addSubLineItem(SubLineItem.ofTier(tier)) - /** Alias for calling [addSubLineItem] with `SubLineItem.ofOther(other)`. */ - fun addSubLineItem(other: SubLineItem.OtherSubLineItem) = - addSubLineItem(SubLineItem.ofOther(other)) + /** Alias for calling [addSubLineItem] with `SubLineItem.ofNull(null_)`. */ + fun addSubLineItem(null_: SubLineItem.Null) = addSubLineItem(SubLineItem.ofNull(null_)) /** The line amount before before any adjustments. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) @@ -1363,66 +1348,55 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val monetaryUsageDiscount: MonetaryUsageDiscountAdjustment? = null, - private val monetaryAmountDiscount: MonetaryAmountDiscountAdjustment? = null, - private val monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment? = null, - private val monetaryMinimum: MonetaryMinimumAdjustment? = null, - private val monetaryMaximum: MonetaryMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun monetaryUsageDiscount(): Optional = - Optional.ofNullable(monetaryUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun monetaryAmountDiscount(): Optional = - Optional.ofNullable(monetaryAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun monetaryPercentageDiscount(): Optional = - Optional.ofNullable(monetaryPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun monetaryMinimum(): Optional = - Optional.ofNullable(monetaryMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun monetaryMaximum(): Optional = - Optional.ofNullable(monetaryMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isMonetaryUsageDiscount(): Boolean = monetaryUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isMonetaryAmountDiscount(): Boolean = monetaryAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isMonetaryPercentageDiscount(): Boolean = monetaryPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isMonetaryMinimum(): Boolean = monetaryMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isMonetaryMaximum(): Boolean = monetaryMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asMonetaryUsageDiscount(): MonetaryUsageDiscountAdjustment = - monetaryUsageDiscount.getOrThrow("monetaryUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asMonetaryAmountDiscount(): MonetaryAmountDiscountAdjustment = - monetaryAmountDiscount.getOrThrow("monetaryAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asMonetaryPercentageDiscount(): MonetaryPercentageDiscountAdjustment = - monetaryPercentageDiscount.getOrThrow("monetaryPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asMonetaryMinimum(): MonetaryMinimumAdjustment = - monetaryMinimum.getOrThrow("monetaryMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asMonetaryMaximum(): MonetaryMaximumAdjustment = - monetaryMaximum.getOrThrow("monetaryMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - monetaryUsageDiscount != null -> - visitor.visitMonetaryUsageDiscount(monetaryUsageDiscount) - monetaryAmountDiscount != null -> - visitor.visitMonetaryAmountDiscount(monetaryAmountDiscount) - monetaryPercentageDiscount != null -> - visitor.visitMonetaryPercentageDiscount(monetaryPercentageDiscount) - monetaryMinimum != null -> visitor.visitMonetaryMinimum(monetaryMinimum) - monetaryMaximum != null -> visitor.visitMonetaryMaximum(monetaryMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1435,30 +1409,24 @@ private constructor( accept( object : Visitor { - override fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) { - monetaryUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) { - monetaryAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) { - monetaryPercentageDiscount.validate() + override fun visitPercentageDiscount(percentageDiscount: PercentageDiscount) { + percentageDiscount.validate() } - override fun visitMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment) { - monetaryMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment) { - monetaryMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -1483,23 +1451,18 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ) = monetaryUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ) = monetaryAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) = monetaryPercentageDiscount.validity() + override fun visitPercentageDiscount(percentageDiscount: PercentageDiscount) = + percentageDiscount.validity() - override fun visitMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment) = - monetaryMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment) = - monetaryMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -1510,21 +1473,18 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && monetaryUsageDiscount == other.monetaryUsageDiscount && monetaryAmountDiscount == other.monetaryAmountDiscount && monetaryPercentageDiscount == other.monetaryPercentageDiscount && monetaryMinimum == other.monetaryMinimum && monetaryMaximum == other.monetaryMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(monetaryUsageDiscount, monetaryAmountDiscount, monetaryPercentageDiscount, monetaryMinimum, monetaryMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - monetaryUsageDiscount != null -> - "Adjustment{monetaryUsageDiscount=$monetaryUsageDiscount}" - monetaryAmountDiscount != null -> - "Adjustment{monetaryAmountDiscount=$monetaryAmountDiscount}" - monetaryPercentageDiscount != null -> - "Adjustment{monetaryPercentageDiscount=$monetaryPercentageDiscount}" - monetaryMinimum != null -> "Adjustment{monetaryMinimum=$monetaryMinimum}" - monetaryMaximum != null -> "Adjustment{monetaryMaximum=$monetaryMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -1532,25 +1492,20 @@ private constructor( companion object { @JvmStatic - fun ofMonetaryUsageDiscount(monetaryUsageDiscount: MonetaryUsageDiscountAdjustment) = - Adjustment(monetaryUsageDiscount = monetaryUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofMonetaryAmountDiscount(monetaryAmountDiscount: MonetaryAmountDiscountAdjustment) = - Adjustment(monetaryAmountDiscount = monetaryAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ) = Adjustment(monetaryPercentageDiscount = monetaryPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment) = - Adjustment(monetaryMinimum = monetaryMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment) = - Adjustment(monetaryMaximum = monetaryMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -1558,21 +1513,15 @@ private constructor( */ interface Visitor { - fun visitMonetaryUsageDiscount( - monetaryUsageDiscount: MonetaryUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitMonetaryAmountDiscount( - monetaryAmountDiscount: MonetaryAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitMonetaryPercentageDiscount( - monetaryPercentageDiscount: MonetaryPercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitMonetaryMinimum(monetaryMinimum: MonetaryMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitMonetaryMaximum(monetaryMaximum: MonetaryMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -1598,38 +1547,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(monetaryPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(monetaryMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(monetaryMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -1645,21 +1585,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.monetaryUsageDiscount != null -> - generator.writeObject(value.monetaryUsageDiscount) - value.monetaryAmountDiscount != null -> - generator.writeObject(value.monetaryAmountDiscount) - value.monetaryPercentageDiscount != null -> - generator.writeObject(value.monetaryPercentageDiscount) - value.monetaryMinimum != null -> generator.writeObject(value.monetaryMinimum) - value.monetaryMaximum != null -> generator.writeObject(value.monetaryMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class MonetaryUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -1836,8 +1774,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -1852,7 +1789,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1865,19 +1802,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryUsageDiscountAdjustment: MonetaryUsageDiscountAdjustment - ) = apply { - id = monetaryUsageDiscountAdjustment.id - adjustmentType = monetaryUsageDiscountAdjustment.adjustmentType - amount = monetaryUsageDiscountAdjustment.amount - appliesToPriceIds = - monetaryUsageDiscountAdjustment.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = monetaryUsageDiscountAdjustment.isInvoiceLevel - reason = monetaryUsageDiscountAdjustment.reason - usageDiscount = monetaryUsageDiscountAdjustment.usageDiscount - additionalProperties = - monetaryUsageDiscountAdjustment.additionalProperties.toMutableMap() + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType + amount = usageDiscount.amount + appliesToPriceIds = usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2020,7 +1953,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2036,8 +1969,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryUsageDiscountAdjustment = - MonetaryUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -2053,7 +1986,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2101,7 +2034,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2111,10 +2044,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class MonetaryAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2289,8 +2222,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2305,7 +2237,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2318,21 +2250,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryAmountDiscountAdjustment: MonetaryAmountDiscountAdjustment - ) = apply { - id = monetaryAmountDiscountAdjustment.id - adjustmentType = monetaryAmountDiscountAdjustment.adjustmentType - amount = monetaryAmountDiscountAdjustment.amount - amountDiscount = monetaryAmountDiscountAdjustment.amountDiscount - appliesToPriceIds = - monetaryAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryAmountDiscountAdjustment.isInvoiceLevel - reason = monetaryAmountDiscountAdjustment.reason - additionalProperties = - monetaryAmountDiscountAdjustment.additionalProperties.toMutableMap() + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + amount = amountDiscount.amount + this.amountDiscount = amountDiscount.amountDiscount + appliesToPriceIds = amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2475,7 +2401,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2491,8 +2417,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryAmountDiscountAdjustment = - MonetaryAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -2508,7 +2434,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -2556,7 +2482,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2566,10 +2492,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryPercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2744,8 +2670,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryPercentageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [PercentageDiscount]. * * The following fields are required: * ```java @@ -2760,7 +2685,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryPercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2773,21 +2698,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - monetaryPercentageDiscountAdjustment: MonetaryPercentageDiscountAdjustment - ) = apply { - id = monetaryPercentageDiscountAdjustment.id - adjustmentType = monetaryPercentageDiscountAdjustment.adjustmentType - amount = monetaryPercentageDiscountAdjustment.amount + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType + amount = percentageDiscount.amount appliesToPriceIds = - monetaryPercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = monetaryPercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = monetaryPercentageDiscountAdjustment.percentageDiscount - reason = monetaryPercentageDiscountAdjustment.reason - additionalProperties = - monetaryPercentageDiscountAdjustment.additionalProperties.toMutableMap() + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + reason = percentageDiscount.reason + additionalProperties = percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2930,7 +2850,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryPercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2946,8 +2866,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryPercentageDiscountAdjustment = - MonetaryPercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -2963,7 +2883,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryPercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3013,7 +2933,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -3023,10 +2943,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3222,8 +3142,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3239,7 +3158,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3253,18 +3172,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(monetaryMinimumAdjustment: MonetaryMinimumAdjustment) = apply { - id = monetaryMinimumAdjustment.id - adjustmentType = monetaryMinimumAdjustment.adjustmentType - amount = monetaryMinimumAdjustment.amount - appliesToPriceIds = - monetaryMinimumAdjustment.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = monetaryMinimumAdjustment.isInvoiceLevel - itemId = monetaryMinimumAdjustment.itemId - minimumAmount = monetaryMinimumAdjustment.minimumAmount - reason = monetaryMinimumAdjustment.reason - additionalProperties = - monetaryMinimumAdjustment.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + amount = minimum.amount + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3419,7 +3336,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3436,8 +3353,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryMinimumAdjustment = - MonetaryMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -3454,7 +3371,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -3504,7 +3421,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -3514,10 +3431,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" } - class MonetaryMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3692,8 +3609,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MonetaryMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -3708,7 +3624,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MonetaryMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3721,17 +3637,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(monetaryMaximumAdjustment: MonetaryMaximumAdjustment) = apply { - id = monetaryMaximumAdjustment.id - adjustmentType = monetaryMaximumAdjustment.adjustmentType - amount = monetaryMaximumAdjustment.amount - appliesToPriceIds = - monetaryMaximumAdjustment.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = monetaryMaximumAdjustment.isInvoiceLevel - maximumAmount = monetaryMaximumAdjustment.maximumAmount - reason = monetaryMaximumAdjustment.reason - additionalProperties = - monetaryMaximumAdjustment.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + amount = maximum.amount + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3874,7 +3788,7 @@ private constructor( } /** - * Returns an immutable instance of [MonetaryMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3890,8 +3804,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MonetaryMaximumAdjustment = - MonetaryMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("amount", amount), @@ -3907,7 +3821,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MonetaryMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -3955,7 +3869,7 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -3965,7 +3879,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4433,29 +4347,29 @@ private constructor( @JsonSerialize(using = SubLineItem.Serializer::class) class SubLineItem private constructor( - private val matrix: MatrixSubLineItem? = null, - private val tier: TierSubLineItem? = null, - private val other: OtherSubLineItem? = null, + private val matrix: Matrix? = null, + private val tier: Tier? = null, + private val null_: Null? = null, private val _json: JsonValue? = null, ) { - fun matrix(): Optional = Optional.ofNullable(matrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun tier(): Optional = Optional.ofNullable(tier) + fun tier(): Optional = Optional.ofNullable(tier) - fun other(): Optional = Optional.ofNullable(other) + fun null_(): Optional = Optional.ofNullable(null_) fun isMatrix(): Boolean = matrix != null fun isTier(): Boolean = tier != null - fun isOther(): Boolean = other != null + fun isNull(): Boolean = null_ != null - fun asMatrix(): MatrixSubLineItem = matrix.getOrThrow("matrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asTier(): TierSubLineItem = tier.getOrThrow("tier") + fun asTier(): Tier = tier.getOrThrow("tier") - fun asOther(): OtherSubLineItem = other.getOrThrow("other") + fun asNull(): Null = null_.getOrThrow("null_") fun _json(): Optional = Optional.ofNullable(_json) @@ -4463,7 +4377,7 @@ private constructor( when { matrix != null -> visitor.visitMatrix(matrix) tier != null -> visitor.visitTier(tier) - other != null -> visitor.visitOther(other) + null_ != null -> visitor.visitNull(null_) else -> visitor.unknown(_json) } @@ -4476,16 +4390,16 @@ private constructor( accept( object : Visitor { - override fun visitMatrix(matrix: MatrixSubLineItem) { + override fun visitMatrix(matrix: Matrix) { matrix.validate() } - override fun visitTier(tier: TierSubLineItem) { + override fun visitTier(tier: Tier) { tier.validate() } - override fun visitOther(other: OtherSubLineItem) { - other.validate() + override fun visitNull(null_: Null) { + null_.validate() } } ) @@ -4510,11 +4424,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitMatrix(matrix: MatrixSubLineItem) = matrix.validity() + override fun visitMatrix(matrix: Matrix) = matrix.validity() - override fun visitTier(tier: TierSubLineItem) = tier.validity() + override fun visitTier(tier: Tier) = tier.validity() - override fun visitOther(other: OtherSubLineItem) = other.validity() + override fun visitNull(null_: Null) = null_.validity() override fun unknown(json: JsonValue?) = 0 } @@ -4525,27 +4439,27 @@ private constructor( return true } - return /* spotless:off */ other is SubLineItem && matrix == other.matrix && tier == other.tier && this.other == other.other /* spotless:on */ + return /* spotless:off */ other is SubLineItem && matrix == other.matrix && tier == other.tier && null_ == other.null_ /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(matrix, tier, other) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(matrix, tier, null_) /* spotless:on */ override fun toString(): String = when { matrix != null -> "SubLineItem{matrix=$matrix}" tier != null -> "SubLineItem{tier=$tier}" - other != null -> "SubLineItem{other=$other}" + null_ != null -> "SubLineItem{null_=$null_}" _json != null -> "SubLineItem{_unknown=$_json}" else -> throw IllegalStateException("Invalid SubLineItem") } companion object { - @JvmStatic fun ofMatrix(matrix: MatrixSubLineItem) = SubLineItem(matrix = matrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = SubLineItem(matrix = matrix) - @JvmStatic fun ofTier(tier: TierSubLineItem) = SubLineItem(tier = tier) + @JvmStatic fun ofTier(tier: Tier) = SubLineItem(tier = tier) - @JvmStatic fun ofOther(other: OtherSubLineItem) = SubLineItem(other = other) + @JvmStatic fun ofNull(null_: Null) = SubLineItem(null_ = null_) } /** @@ -4554,11 +4468,11 @@ private constructor( */ interface Visitor { - fun visitMatrix(matrix: MatrixSubLineItem): T + fun visitMatrix(matrix: Matrix): T - fun visitTier(tier: TierSubLineItem): T + fun visitTier(tier: Tier): T - fun visitOther(other: OtherSubLineItem): T + fun visitNull(null_: Null): T /** * Maps an unknown variant of [SubLineItem] to a value of type [T]. @@ -4583,18 +4497,18 @@ private constructor( when (type) { "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { SubLineItem(matrix = it, _json = json) } ?: SubLineItem(_json = json) } "tier" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { SubLineItem(tier = it, _json = json) } ?: SubLineItem(_json = json) } "'null'" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - SubLineItem(other = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + SubLineItem(null_ = it, _json = json) } ?: SubLineItem(_json = json) } } @@ -4613,14 +4527,14 @@ private constructor( when { value.matrix != null -> generator.writeObject(value.matrix) value.tier != null -> generator.writeObject(value.tier) - value.other != null -> generator.writeObject(value.other) + value.null_ != null -> generator.writeObject(value.null_) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid SubLineItem") } } } - class MatrixSubLineItem + class Matrix private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -4753,7 +4667,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [MatrixSubLineItem]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -4767,7 +4681,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixSubLineItem]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -4779,14 +4693,14 @@ private constructor( 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 - type = matrixSubLineItem.type - additionalProperties = matrixSubLineItem.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + amount = matrix.amount + grouping = matrix.grouping + matrixConfig = matrix.matrixConfig + name = matrix.name + quantity = matrix.quantity + type = matrix.type + additionalProperties = matrix.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -4888,7 +4802,7 @@ private constructor( } /** - * Returns an immutable instance of [MatrixSubLineItem]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4903,8 +4817,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MatrixSubLineItem = - MatrixSubLineItem( + fun build(): Matrix = + Matrix( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("matrixConfig", matrixConfig), @@ -4917,7 +4831,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixSubLineItem = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -5355,7 +5269,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -5365,10 +5279,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MatrixSubLineItem{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" + "Matrix{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } - class TierSubLineItem + class Tier private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -5501,7 +5415,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TierSubLineItem]. + * Returns a mutable builder for constructing an instance of [Tier]. * * The following fields are required: * ```java @@ -5515,7 +5429,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TierSubLineItem]. */ + /** A builder for [Tier]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -5527,14 +5441,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tierSubLineItem: TierSubLineItem) = apply { - amount = tierSubLineItem.amount - grouping = tierSubLineItem.grouping - name = tierSubLineItem.name - quantity = tierSubLineItem.quantity - tierConfig = tierSubLineItem.tierConfig - type = tierSubLineItem.type - additionalProperties = tierSubLineItem.additionalProperties.toMutableMap() + internal fun from(tier: Tier) = apply { + amount = tier.amount + grouping = tier.grouping + name = tier.name + quantity = tier.quantity + tierConfig = tier.tierConfig + type = tier.type + additionalProperties = tier.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -5635,7 +5549,7 @@ private constructor( } /** - * Returns an immutable instance of [TierSubLineItem]. + * Returns an immutable instance of [Tier]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5650,8 +5564,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TierSubLineItem = - TierSubLineItem( + fun build(): Tier = + Tier( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("name", name), @@ -5664,7 +5578,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TierSubLineItem = apply { + fun validate(): Tier = apply { if (validated) { return@apply } @@ -6170,7 +6084,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tier && 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 */ @@ -6180,10 +6094,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "TierSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" + "Tier{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" } - class OtherSubLineItem + class Null private constructor( private val amount: JsonField, private val grouping: JsonField, @@ -6295,7 +6209,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [OtherSubLineItem]. + * Returns a mutable builder for constructing an instance of [Null]. * * The following fields are required: * ```java @@ -6308,7 +6222,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [OtherSubLineItem]. */ + /** A builder for [Null]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -6319,13 +6233,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(otherSubLineItem: OtherSubLineItem) = apply { - amount = otherSubLineItem.amount - grouping = otherSubLineItem.grouping - name = otherSubLineItem.name - quantity = otherSubLineItem.quantity - type = otherSubLineItem.type - additionalProperties = otherSubLineItem.additionalProperties.toMutableMap() + internal fun from(null_: Null) = apply { + amount = null_.amount + grouping = null_.grouping + name = null_.name + quantity = null_.quantity + type = null_.type + additionalProperties = null_.additionalProperties.toMutableMap() } /** The total amount for this sub line item. */ @@ -6413,7 +6327,7 @@ private constructor( } /** - * Returns an immutable instance of [OtherSubLineItem]. + * Returns an immutable instance of [Null]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6427,8 +6341,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): OtherSubLineItem = - OtherSubLineItem( + fun build(): Null = + Null( checkRequired("amount", amount), checkRequired("grouping", grouping), checkRequired("name", name), @@ -6440,7 +6354,7 @@ private constructor( private var validated: Boolean = false - fun validate(): OtherSubLineItem = apply { + fun validate(): Null = apply { if (validated) { return@apply } @@ -6687,7 +6601,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Null && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -6697,7 +6611,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "OtherSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" + "Null{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, 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 2385aa899..483ecad4f 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 @@ -651,39 +651,28 @@ private constructor( } } - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun addAdjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - addAdjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [addAdjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun addAdjustment(usageDiscount: Adjustment.UsageDiscount) = + addAdjustment(Adjustment.ofUsageDiscount(usageDiscount)) - /** - * Alias for calling [addAdjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. - */ - fun addAdjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - addAdjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + /** Alias for calling [addAdjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ + fun addAdjustment(amountDiscount: Adjustment.AmountDiscount) = + addAdjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [addAdjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun addAdjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = addAdjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun addAdjustment(percentageDiscount: Adjustment.PercentageDiscount) = + addAdjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [addAdjustment] with `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun addAdjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - addAdjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun addAdjustment(minimum: Adjustment.Minimum) = + addAdjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [addAdjustment] with `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun addAdjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - addAdjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [addAdjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun addAdjustment(maximum: Adjustment.Maximum) = + addAdjustment(Adjustment.ofMaximum(maximum)) fun basePlan(basePlan: BasePlan?) = basePlan(JsonField.ofNullable(basePlan)) @@ -1033,137 +1022,136 @@ private constructor( } /** Alias for calling [addPrice] with `Price.ofUnit(unit)`. */ - fun addPrice(unit: Price.UnitPrice) = addPrice(Price.ofUnit(unit)) + fun addPrice(unit: Price.Unit) = addPrice(Price.ofUnit(unit)) - /** Alias for calling [addPrice] with `Price.ofPackagePrice(packagePrice)`. */ - fun addPrice(packagePrice: Price.PackagePrice) = - addPrice(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [addPrice] with `Price.ofPackage(package_)`. */ + fun addPrice(package_: Price.Package) = addPrice(Price.ofPackage(package_)) /** Alias for calling [addPrice] with `Price.ofMatrix(matrix)`. */ - fun addPrice(matrix: Price.MatrixPrice) = addPrice(Price.ofMatrix(matrix)) + fun addPrice(matrix: Price.Matrix) = addPrice(Price.ofMatrix(matrix)) /** Alias for calling [addPrice] with `Price.ofTiered(tiered)`. */ - fun addPrice(tiered: Price.TieredPrice) = addPrice(Price.ofTiered(tiered)) + fun addPrice(tiered: Price.Tiered) = addPrice(Price.ofTiered(tiered)) /** Alias for calling [addPrice] with `Price.ofTieredBps(tieredBps)`. */ - fun addPrice(tieredBps: Price.TieredBpsPrice) = addPrice(Price.ofTieredBps(tieredBps)) + fun addPrice(tieredBps: Price.TieredBps) = addPrice(Price.ofTieredBps(tieredBps)) /** Alias for calling [addPrice] with `Price.ofBps(bps)`. */ - fun addPrice(bps: Price.BpsPrice) = addPrice(Price.ofBps(bps)) + fun addPrice(bps: Price.Bps) = addPrice(Price.ofBps(bps)) /** Alias for calling [addPrice] with `Price.ofBulkBps(bulkBps)`. */ - fun addPrice(bulkBps: Price.BulkBpsPrice) = addPrice(Price.ofBulkBps(bulkBps)) + fun addPrice(bulkBps: Price.BulkBps) = addPrice(Price.ofBulkBps(bulkBps)) /** Alias for calling [addPrice] with `Price.ofBulk(bulk)`. */ - fun addPrice(bulk: Price.BulkPrice) = addPrice(Price.ofBulk(bulk)) + fun addPrice(bulk: Price.Bulk) = addPrice(Price.ofBulk(bulk)) /** * Alias for calling [addPrice] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun addPrice(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun addPrice(thresholdTotalAmount: Price.ThresholdTotalAmount) = addPrice(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [addPrice] with `Price.ofTieredPackage(tieredPackage)`. */ - fun addPrice(tieredPackage: Price.TieredPackagePrice) = + fun addPrice(tieredPackage: Price.TieredPackage) = addPrice(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [addPrice] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun addPrice(groupedTiered: Price.GroupedTieredPrice) = + fun addPrice(groupedTiered: Price.GroupedTiered) = addPrice(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [addPrice] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun addPrice(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun addPrice(tieredWithMinimum: Price.TieredWithMinimum) = addPrice(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [addPrice] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun addPrice(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun addPrice(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = addPrice(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [addPrice] with `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun addPrice(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun addPrice(packageWithAllocation: Price.PackageWithAllocation) = addPrice(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [addPrice] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun addPrice(unitWithPercent: Price.UnitWithPercentPrice) = + fun addPrice(unitWithPercent: Price.UnitWithPercent) = addPrice(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [addPrice] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun addPrice(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun addPrice(matrixWithAllocation: Price.MatrixWithAllocation) = addPrice(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** Alias for calling [addPrice] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun addPrice(tieredWithProration: Price.TieredWithProrationPrice) = + fun addPrice(tieredWithProration: Price.TieredWithProration) = addPrice(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [addPrice] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun addPrice(unitWithProration: Price.UnitWithProrationPrice) = + fun addPrice(unitWithProration: Price.UnitWithProration) = addPrice(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [addPrice] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun addPrice(groupedAllocation: Price.GroupedAllocationPrice) = + fun addPrice(groupedAllocation: Price.GroupedAllocation) = addPrice(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [addPrice] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun addPrice(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun addPrice(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = addPrice(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [addPrice] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun addPrice(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun addPrice(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = addPrice(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [addPrice] with `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun addPrice(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun addPrice(matrixWithDisplayName: Price.MatrixWithDisplayName) = addPrice(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [addPrice] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun addPrice(bulkWithProration: Price.BulkWithProrationPrice) = + fun addPrice(bulkWithProration: Price.BulkWithProration) = addPrice(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [addPrice] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun addPrice(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun addPrice(groupedTieredPackage: Price.GroupedTieredPackage) = addPrice(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [addPrice] with `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun addPrice(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun addPrice(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = addPrice(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [addPrice] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun addPrice(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun addPrice(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = addPrice(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [addPrice] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun addPrice(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun addPrice(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = addPrice(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [addPrice] with `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun addPrice(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun addPrice(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = addPrice(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) fun product(product: Product) = product(JsonField.of(product)) @@ -1371,66 +1359,55 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1443,34 +1420,24 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) { - planPhasePercentageDiscount.validate() + override fun visitPercentageDiscount(percentageDiscount: PercentageDiscount) { + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -1495,25 +1462,18 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount(percentageDiscount: PercentageDiscount) = + percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -1524,21 +1484,18 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -1546,26 +1503,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount(planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment) = - Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -1573,21 +1524,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -1613,38 +1558,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -1660,21 +1596,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -1853,8 +1787,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -1869,7 +1802,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1882,21 +1815,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType - appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType + appliesToPriceIds = usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2055,7 +1982,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2071,8 +1998,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2088,7 +2015,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2136,7 +2063,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2146,10 +2073,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2326,8 +2253,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2342,7 +2268,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2355,21 +2281,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount - appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount + appliesToPriceIds = amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2528,7 +2448,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2544,8 +2464,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -2561,7 +2481,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -2609,7 +2529,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -2619,10 +2539,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2799,8 +2719,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [PercentageDiscount]. * * The following fields are required: * ```java @@ -2815,7 +2734,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2828,21 +2747,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason - additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties.toMutableMap() + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason + additionalProperties = percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3001,7 +2915,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3017,8 +2931,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3034,7 +2948,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3084,7 +2998,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3094,10 +3008,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3295,8 +3209,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3312,7 +3225,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3326,18 +3239,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3508,7 +3419,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3525,8 +3436,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3543,7 +3454,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -3593,7 +3504,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -3603,10 +3514,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3783,8 +3694,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -3799,7 +3709,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3812,17 +3722,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3981,7 +3889,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3997,8 +3905,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4014,7 +3922,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4062,7 +3970,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4072,7 +3980,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, 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 060c743ea..5da7c7eb2 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 @@ -257,179 +257,137 @@ private constructor( */ fun addPrice(price: Price) = apply { body.addPrice(price) } - /** Alias for calling [addPrice] with `Price.ofNewPlanUnit(newPlanUnit)`. */ - fun addPrice(newPlanUnit: Price.NewPlanUnitPrice) = apply { body.addPrice(newPlanUnit) } + /** Alias for calling [addPrice] with `Price.ofUnit(unit)`. */ + fun addPrice(unit: Price.Unit) = apply { body.addPrice(unit) } - /** Alias for calling [addPrice] with `Price.ofNewPlanPackage(newPlanPackage)`. */ - fun addPrice(newPlanPackage: Price.NewPlanPackagePrice) = apply { - body.addPrice(newPlanPackage) - } + /** Alias for calling [addPrice] with `Price.ofPackage(package_)`. */ + fun addPrice(package_: Price.Package) = apply { body.addPrice(package_) } - /** Alias for calling [addPrice] with `Price.ofNewPlanMatrix(newPlanMatrix)`. */ - fun addPrice(newPlanMatrix: Price.NewPlanMatrixPrice) = apply { - body.addPrice(newPlanMatrix) - } + /** Alias for calling [addPrice] with `Price.ofMatrix(matrix)`. */ + fun addPrice(matrix: Price.Matrix) = apply { body.addPrice(matrix) } - /** Alias for calling [addPrice] with `Price.ofNewPlanTiered(newPlanTiered)`. */ - fun addPrice(newPlanTiered: Price.NewPlanTieredPrice) = apply { - body.addPrice(newPlanTiered) - } + /** Alias for calling [addPrice] with `Price.ofTiered(tiered)`. */ + fun addPrice(tiered: Price.Tiered) = apply { body.addPrice(tiered) } - /** Alias for calling [addPrice] with `Price.ofNewPlanTieredBps(newPlanTieredBps)`. */ - fun addPrice(newPlanTieredBps: Price.NewPlanTieredBpsPrice) = apply { - body.addPrice(newPlanTieredBps) - } + /** Alias for calling [addPrice] with `Price.ofTieredBps(tieredBps)`. */ + fun addPrice(tieredBps: Price.TieredBps) = apply { body.addPrice(tieredBps) } - /** Alias for calling [addPrice] with `Price.ofNewPlanBps(newPlanBps)`. */ - fun addPrice(newPlanBps: Price.NewPlanBpsPrice) = apply { body.addPrice(newPlanBps) } + /** Alias for calling [addPrice] with `Price.ofBps(bps)`. */ + fun addPrice(bps: Price.Bps) = apply { body.addPrice(bps) } - /** Alias for calling [addPrice] with `Price.ofNewPlanBulkBps(newPlanBulkBps)`. */ - fun addPrice(newPlanBulkBps: Price.NewPlanBulkBpsPrice) = apply { - body.addPrice(newPlanBulkBps) - } + /** Alias for calling [addPrice] with `Price.ofBulkBps(bulkBps)`. */ + fun addPrice(bulkBps: Price.BulkBps) = apply { body.addPrice(bulkBps) } - /** Alias for calling [addPrice] with `Price.ofNewPlanBulk(newPlanBulk)`. */ - fun addPrice(newPlanBulk: Price.NewPlanBulkPrice) = apply { body.addPrice(newPlanBulk) } + /** Alias for calling [addPrice] with `Price.ofBulk(bulk)`. */ + fun addPrice(bulk: Price.Bulk) = apply { body.addPrice(bulk) } /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanThresholdTotalAmount(newPlanThresholdTotalAmount)`. + * Alias for calling [addPrice] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun addPrice(newPlanThresholdTotalAmount: Price.NewPlanThresholdTotalAmountPrice) = apply { - body.addPrice(newPlanThresholdTotalAmount) + fun addPrice(thresholdTotalAmount: Price.ThresholdTotalAmount) = apply { + body.addPrice(thresholdTotalAmount) } - /** - * Alias for calling [addPrice] with `Price.ofNewPlanTieredPackage(newPlanTieredPackage)`. - */ - fun addPrice(newPlanTieredPackage: Price.NewPlanTieredPackagePrice) = apply { - body.addPrice(newPlanTieredPackage) + /** Alias for calling [addPrice] with `Price.ofTieredPackage(tieredPackage)`. */ + fun addPrice(tieredPackage: Price.TieredPackage) = apply { body.addPrice(tieredPackage) } + + /** Alias for calling [addPrice] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun addPrice(tieredWithMinimum: Price.TieredWithMinimum) = apply { + body.addPrice(tieredWithMinimum) } - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanTieredWithMinimum(newPlanTieredWithMinimum)`. - */ - fun addPrice(newPlanTieredWithMinimum: Price.NewPlanTieredWithMinimumPrice) = apply { - body.addPrice(newPlanTieredWithMinimum) + /** Alias for calling [addPrice] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun addPrice(unitWithPercent: Price.UnitWithPercent) = apply { + body.addPrice(unitWithPercent) } /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanUnitWithPercent(newPlanUnitWithPercent)`. + * Alias for calling [addPrice] with `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun addPrice(newPlanUnitWithPercent: Price.NewPlanUnitWithPercentPrice) = apply { - body.addPrice(newPlanUnitWithPercent) + fun addPrice(packageWithAllocation: Price.PackageWithAllocation) = apply { + body.addPrice(packageWithAllocation) } - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanPackageWithAllocation(newPlanPackageWithAllocation)`. - */ - fun addPrice(newPlanPackageWithAllocation: Price.NewPlanPackageWithAllocationPrice) = - apply { - body.addPrice(newPlanPackageWithAllocation) - } + /** Alias for calling [addPrice] with `Price.ofTieredWithProration(tieredWithProration)`. */ + fun addPrice(tieredWithProration: Price.TieredWithProration) = apply { + body.addPrice(tieredWithProration) + } - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanTierWithProration(newPlanTierWithProration)`. - */ - fun addPrice(newPlanTierWithProration: Price.NewPlanTierWithProrationPrice) = apply { - body.addPrice(newPlanTierWithProration) + /** Alias for calling [addPrice] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun addPrice(unitWithProration: Price.UnitWithProration) = apply { + body.addPrice(unitWithProration) } - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanUnitWithProration(newPlanUnitWithProration)`. - */ - fun addPrice(newPlanUnitWithProration: Price.NewPlanUnitWithProrationPrice) = apply { - body.addPrice(newPlanUnitWithProration) + /** Alias for calling [addPrice] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun addPrice(groupedAllocation: Price.GroupedAllocation) = apply { + body.addPrice(groupedAllocation) } /** * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedAllocation(newPlanGroupedAllocation)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun addPrice(newPlanGroupedAllocation: Price.NewPlanGroupedAllocationPrice) = apply { - body.addPrice(newPlanGroupedAllocation) + fun addPrice(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = apply { + body.addPrice(groupedWithProratedMinimum) } /** * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedWithProratedMinimum(newPlanGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun addPrice( - newPlanGroupedWithProratedMinimum: Price.NewPlanGroupedWithProratedMinimumPrice - ) = apply { body.addPrice(newPlanGroupedWithProratedMinimum) } + fun addPrice(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = apply { + body.addPrice(groupedWithMeteredMinimum) + } /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedWithMeteredMinimum(newPlanGroupedWithMeteredMinimum)`. + * Alias for calling [addPrice] with `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun addPrice( - newPlanGroupedWithMeteredMinimum: Price.NewPlanGroupedWithMeteredMinimumPrice - ) = apply { body.addPrice(newPlanGroupedWithMeteredMinimum) } + fun addPrice(matrixWithDisplayName: Price.MatrixWithDisplayName) = apply { + body.addPrice(matrixWithDisplayName) + } + + /** Alias for calling [addPrice] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun addPrice(bulkWithProration: Price.BulkWithProration) = apply { + body.addPrice(bulkWithProration) + } /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanMatrixWithDisplayName(newPlanMatrixWithDisplayName)`. + * Alias for calling [addPrice] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun addPrice(newPlanMatrixWithDisplayName: Price.NewPlanMatrixWithDisplayNamePrice) = - apply { - body.addPrice(newPlanMatrixWithDisplayName) - } + fun addPrice(groupedTieredPackage: Price.GroupedTieredPackage) = apply { + body.addPrice(groupedTieredPackage) + } /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanBulkWithProration(newPlanBulkWithProration)`. + * Alias for calling [addPrice] with `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun addPrice(newPlanBulkWithProration: Price.NewPlanBulkWithProrationPrice) = apply { - body.addPrice(newPlanBulkWithProration) + fun addPrice(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = apply { + body.addPrice(maxGroupTieredPackage) } /** * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedTieredPackage(newPlanGroupedTieredPackage)`. + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun addPrice(newPlanGroupedTieredPackage: Price.NewPlanGroupedTieredPackagePrice) = apply { - body.addPrice(newPlanGroupedTieredPackage) + fun addPrice(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = apply { + body.addPrice(scalableMatrixWithUnitPricing) } /** * Alias for calling [addPrice] with - * `Price.ofNewPlanMaxGroupTieredPackage(newPlanMaxGroupTieredPackage)`. + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun addPrice(newPlanMaxGroupTieredPackage: Price.NewPlanMaxGroupTieredPackagePrice) = + fun addPrice(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = apply { - body.addPrice(newPlanMaxGroupTieredPackage) + body.addPrice(scalableMatrixWithTieredPricing) } /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanScalableMatrixWithUnitPricing(newPlanScalableMatrixWithUnitPricing)`. - */ - fun addPrice( - newPlanScalableMatrixWithUnitPricing: Price.NewPlanScalableMatrixWithUnitPricingPrice - ) = apply { body.addPrice(newPlanScalableMatrixWithUnitPricing) } - - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanScalableMatrixWithTieredPricing(newPlanScalableMatrixWithTieredPricing)`. - */ - fun addPrice( - newPlanScalableMatrixWithTieredPricing: - Price.NewPlanScalableMatrixWithTieredPricingPrice - ) = apply { body.addPrice(newPlanScalableMatrixWithTieredPricing) } - - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanCumulativeGroupedBulk(newPlanCumulativeGroupedBulk)`. + * Alias for calling [addPrice] with `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun addPrice(newPlanCumulativeGroupedBulk: Price.NewPlanCumulativeGroupedBulkPrice) = - apply { - body.addPrice(newPlanCumulativeGroupedBulk) - } + fun addPrice(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = apply { + body.addPrice(cumulativeGroupedBulk) + } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { @@ -946,175 +904,129 @@ private constructor( } } - /** Alias for calling [addPrice] with `Price.ofNewPlanUnit(newPlanUnit)`. */ - fun addPrice(newPlanUnit: Price.NewPlanUnitPrice) = - addPrice(Price.ofNewPlanUnit(newPlanUnit)) + /** Alias for calling [addPrice] with `Price.ofUnit(unit)`. */ + fun addPrice(unit: Price.Unit) = addPrice(Price.ofUnit(unit)) - /** Alias for calling [addPrice] with `Price.ofNewPlanPackage(newPlanPackage)`. */ - fun addPrice(newPlanPackage: Price.NewPlanPackagePrice) = - addPrice(Price.ofNewPlanPackage(newPlanPackage)) + /** Alias for calling [addPrice] with `Price.ofPackage(package_)`. */ + fun addPrice(package_: Price.Package) = addPrice(Price.ofPackage(package_)) - /** Alias for calling [addPrice] with `Price.ofNewPlanMatrix(newPlanMatrix)`. */ - fun addPrice(newPlanMatrix: Price.NewPlanMatrixPrice) = - addPrice(Price.ofNewPlanMatrix(newPlanMatrix)) + /** Alias for calling [addPrice] with `Price.ofMatrix(matrix)`. */ + fun addPrice(matrix: Price.Matrix) = addPrice(Price.ofMatrix(matrix)) - /** Alias for calling [addPrice] with `Price.ofNewPlanTiered(newPlanTiered)`. */ - fun addPrice(newPlanTiered: Price.NewPlanTieredPrice) = - addPrice(Price.ofNewPlanTiered(newPlanTiered)) + /** Alias for calling [addPrice] with `Price.ofTiered(tiered)`. */ + fun addPrice(tiered: Price.Tiered) = addPrice(Price.ofTiered(tiered)) - /** Alias for calling [addPrice] with `Price.ofNewPlanTieredBps(newPlanTieredBps)`. */ - fun addPrice(newPlanTieredBps: Price.NewPlanTieredBpsPrice) = - addPrice(Price.ofNewPlanTieredBps(newPlanTieredBps)) + /** Alias for calling [addPrice] with `Price.ofTieredBps(tieredBps)`. */ + fun addPrice(tieredBps: Price.TieredBps) = addPrice(Price.ofTieredBps(tieredBps)) - /** Alias for calling [addPrice] with `Price.ofNewPlanBps(newPlanBps)`. */ - fun addPrice(newPlanBps: Price.NewPlanBpsPrice) = - addPrice(Price.ofNewPlanBps(newPlanBps)) + /** Alias for calling [addPrice] with `Price.ofBps(bps)`. */ + fun addPrice(bps: Price.Bps) = addPrice(Price.ofBps(bps)) - /** Alias for calling [addPrice] with `Price.ofNewPlanBulkBps(newPlanBulkBps)`. */ - fun addPrice(newPlanBulkBps: Price.NewPlanBulkBpsPrice) = - addPrice(Price.ofNewPlanBulkBps(newPlanBulkBps)) + /** Alias for calling [addPrice] with `Price.ofBulkBps(bulkBps)`. */ + fun addPrice(bulkBps: Price.BulkBps) = addPrice(Price.ofBulkBps(bulkBps)) - /** Alias for calling [addPrice] with `Price.ofNewPlanBulk(newPlanBulk)`. */ - fun addPrice(newPlanBulk: Price.NewPlanBulkPrice) = - addPrice(Price.ofNewPlanBulk(newPlanBulk)) + /** Alias for calling [addPrice] with `Price.ofBulk(bulk)`. */ + fun addPrice(bulk: Price.Bulk) = addPrice(Price.ofBulk(bulk)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanThresholdTotalAmount(newPlanThresholdTotalAmount)`. + * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun addPrice(newPlanThresholdTotalAmount: Price.NewPlanThresholdTotalAmountPrice) = - addPrice(Price.ofNewPlanThresholdTotalAmount(newPlanThresholdTotalAmount)) + fun addPrice(thresholdTotalAmount: Price.ThresholdTotalAmount) = + addPrice(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanTieredPackage(newPlanTieredPackage)`. - */ - fun addPrice(newPlanTieredPackage: Price.NewPlanTieredPackagePrice) = - addPrice(Price.ofNewPlanTieredPackage(newPlanTieredPackage)) + /** Alias for calling [addPrice] with `Price.ofTieredPackage(tieredPackage)`. */ + fun addPrice(tieredPackage: Price.TieredPackage) = + addPrice(Price.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanTieredWithMinimum(newPlanTieredWithMinimum)`. - */ - fun addPrice(newPlanTieredWithMinimum: Price.NewPlanTieredWithMinimumPrice) = - addPrice(Price.ofNewPlanTieredWithMinimum(newPlanTieredWithMinimum)) + /** Alias for calling [addPrice] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun addPrice(tieredWithMinimum: Price.TieredWithMinimum) = + addPrice(Price.ofTieredWithMinimum(tieredWithMinimum)) - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanUnitWithPercent(newPlanUnitWithPercent)`. - */ - fun addPrice(newPlanUnitWithPercent: Price.NewPlanUnitWithPercentPrice) = - addPrice(Price.ofNewPlanUnitWithPercent(newPlanUnitWithPercent)) + /** Alias for calling [addPrice] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun addPrice(unitWithPercent: Price.UnitWithPercent) = + addPrice(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanPackageWithAllocation(newPlanPackageWithAllocation)`. + * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun addPrice(newPlanPackageWithAllocation: Price.NewPlanPackageWithAllocationPrice) = - addPrice(Price.ofNewPlanPackageWithAllocation(newPlanPackageWithAllocation)) + fun addPrice(packageWithAllocation: Price.PackageWithAllocation) = + addPrice(Price.ofPackageWithAllocation(packageWithAllocation)) /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanTierWithProration(newPlanTierWithProration)`. + * Alias for calling [addPrice] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun addPrice(newPlanTierWithProration: Price.NewPlanTierWithProrationPrice) = - addPrice(Price.ofNewPlanTierWithProration(newPlanTierWithProration)) + fun addPrice(tieredWithProration: Price.TieredWithProration) = + addPrice(Price.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanUnitWithProration(newPlanUnitWithProration)`. - */ - fun addPrice(newPlanUnitWithProration: Price.NewPlanUnitWithProrationPrice) = - addPrice(Price.ofNewPlanUnitWithProration(newPlanUnitWithProration)) + /** Alias for calling [addPrice] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun addPrice(unitWithProration: Price.UnitWithProration) = + addPrice(Price.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedAllocation(newPlanGroupedAllocation)`. - */ - fun addPrice(newPlanGroupedAllocation: Price.NewPlanGroupedAllocationPrice) = - addPrice(Price.ofNewPlanGroupedAllocation(newPlanGroupedAllocation)) + /** Alias for calling [addPrice] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun addPrice(groupedAllocation: Price.GroupedAllocation) = + addPrice(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedWithProratedMinimum(newPlanGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun addPrice( - newPlanGroupedWithProratedMinimum: Price.NewPlanGroupedWithProratedMinimumPrice - ) = - addPrice( - Price.ofNewPlanGroupedWithProratedMinimum(newPlanGroupedWithProratedMinimum) - ) + fun addPrice(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = + addPrice(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedWithMeteredMinimum(newPlanGroupedWithMeteredMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun addPrice( - newPlanGroupedWithMeteredMinimum: Price.NewPlanGroupedWithMeteredMinimumPrice - ) = addPrice(Price.ofNewPlanGroupedWithMeteredMinimum(newPlanGroupedWithMeteredMinimum)) + fun addPrice(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = + addPrice(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanMatrixWithDisplayName(newPlanMatrixWithDisplayName)`. + * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun addPrice(newPlanMatrixWithDisplayName: Price.NewPlanMatrixWithDisplayNamePrice) = - addPrice(Price.ofNewPlanMatrixWithDisplayName(newPlanMatrixWithDisplayName)) + fun addPrice(matrixWithDisplayName: Price.MatrixWithDisplayName) = + addPrice(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) - /** - * Alias for calling [addPrice] with - * `Price.ofNewPlanBulkWithProration(newPlanBulkWithProration)`. - */ - fun addPrice(newPlanBulkWithProration: Price.NewPlanBulkWithProrationPrice) = - addPrice(Price.ofNewPlanBulkWithProration(newPlanBulkWithProration)) + /** Alias for calling [addPrice] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun addPrice(bulkWithProration: Price.BulkWithProration) = + addPrice(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanGroupedTieredPackage(newPlanGroupedTieredPackage)`. + * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun addPrice(newPlanGroupedTieredPackage: Price.NewPlanGroupedTieredPackagePrice) = - addPrice(Price.ofNewPlanGroupedTieredPackage(newPlanGroupedTieredPackage)) + fun addPrice(groupedTieredPackage: Price.GroupedTieredPackage) = + addPrice(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanMaxGroupTieredPackage(newPlanMaxGroupTieredPackage)`. + * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun addPrice(newPlanMaxGroupTieredPackage: Price.NewPlanMaxGroupTieredPackagePrice) = - addPrice(Price.ofNewPlanMaxGroupTieredPackage(newPlanMaxGroupTieredPackage)) + fun addPrice(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = + addPrice(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanScalableMatrixWithUnitPricing(newPlanScalableMatrixWithUnitPricing)`. - */ - fun addPrice( - newPlanScalableMatrixWithUnitPricing: - Price.NewPlanScalableMatrixWithUnitPricingPrice - ) = - addPrice( - Price.ofNewPlanScalableMatrixWithUnitPricing( - newPlanScalableMatrixWithUnitPricing - ) - ) + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. + */ + fun addPrice(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = + addPrice(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanScalableMatrixWithTieredPricing(newPlanScalableMatrixWithTieredPricing)`. - */ - fun addPrice( - newPlanScalableMatrixWithTieredPricing: - Price.NewPlanScalableMatrixWithTieredPricingPrice - ) = - addPrice( - Price.ofNewPlanScalableMatrixWithTieredPricing( - newPlanScalableMatrixWithTieredPricing - ) - ) + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. + */ + fun addPrice(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + addPrice(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [addPrice] with - * `Price.ofNewPlanCumulativeGroupedBulk(newPlanCumulativeGroupedBulk)`. + * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun addPrice(newPlanCumulativeGroupedBulk: Price.NewPlanCumulativeGroupedBulkPrice) = - addPrice(Price.ofNewPlanCumulativeGroupedBulk(newPlanCumulativeGroupedBulk)) + fun addPrice(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = + addPrice(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = @@ -1327,285 +1239,253 @@ private constructor( @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val newPlanUnit: NewPlanUnitPrice? = null, - private val newPlanPackage: NewPlanPackagePrice? = null, - private val newPlanMatrix: NewPlanMatrixPrice? = null, - private val newPlanTiered: NewPlanTieredPrice? = null, - private val newPlanTieredBps: NewPlanTieredBpsPrice? = null, - private val newPlanBps: NewPlanBpsPrice? = null, - private val newPlanBulkBps: NewPlanBulkBpsPrice? = null, - private val newPlanBulk: NewPlanBulkPrice? = null, - private val newPlanThresholdTotalAmount: NewPlanThresholdTotalAmountPrice? = null, - private val newPlanTieredPackage: NewPlanTieredPackagePrice? = null, - private val newPlanTieredWithMinimum: NewPlanTieredWithMinimumPrice? = null, - private val newPlanUnitWithPercent: NewPlanUnitWithPercentPrice? = null, - private val newPlanPackageWithAllocation: NewPlanPackageWithAllocationPrice? = null, - private val newPlanTierWithProration: NewPlanTierWithProrationPrice? = null, - private val newPlanUnitWithProration: NewPlanUnitWithProrationPrice? = null, - private val newPlanGroupedAllocation: NewPlanGroupedAllocationPrice? = null, - private val newPlanGroupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice? = - null, - private val newPlanGroupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice? = null, - private val newPlanMatrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice? = null, - private val newPlanBulkWithProration: NewPlanBulkWithProrationPrice? = null, - private val newPlanGroupedTieredPackage: NewPlanGroupedTieredPackagePrice? = null, - private val newPlanMaxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice? = null, - private val newPlanScalableMatrixWithUnitPricing: - NewPlanScalableMatrixWithUnitPricingPrice? = - null, - private val newPlanScalableMatrixWithTieredPricing: - NewPlanScalableMatrixWithTieredPricingPrice? = - null, - private val newPlanCumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice? = null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val bulkWithProration: BulkWithProration? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, private val _json: JsonValue? = null, ) { - fun newPlanUnit(): Optional = Optional.ofNullable(newPlanUnit) + fun unit(): Optional = Optional.ofNullable(unit) - fun newPlanPackage(): Optional = Optional.ofNullable(newPlanPackage) + fun package_(): Optional = Optional.ofNullable(package_) - fun newPlanMatrix(): Optional = Optional.ofNullable(newPlanMatrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newPlanTiered(): Optional = Optional.ofNullable(newPlanTiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newPlanTieredBps(): Optional = - Optional.ofNullable(newPlanTieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newPlanBps(): Optional = Optional.ofNullable(newPlanBps) + fun bps(): Optional = Optional.ofNullable(bps) - fun newPlanBulkBps(): Optional = Optional.ofNullable(newPlanBulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newPlanBulk(): Optional = Optional.ofNullable(newPlanBulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newPlanThresholdTotalAmount(): Optional = - Optional.ofNullable(newPlanThresholdTotalAmount) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newPlanTieredPackage(): Optional = - Optional.ofNullable(newPlanTieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newPlanTieredWithMinimum(): Optional = - Optional.ofNullable(newPlanTieredWithMinimum) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newPlanUnitWithPercent(): Optional = - Optional.ofNullable(newPlanUnitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newPlanPackageWithAllocation(): Optional = - Optional.ofNullable(newPlanPackageWithAllocation) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newPlanTierWithProration(): Optional = - Optional.ofNullable(newPlanTierWithProration) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newPlanUnitWithProration(): Optional = - Optional.ofNullable(newPlanUnitWithProration) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newPlanGroupedAllocation(): Optional = - Optional.ofNullable(newPlanGroupedAllocation) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newPlanGroupedWithProratedMinimum(): Optional = - Optional.ofNullable(newPlanGroupedWithProratedMinimum) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newPlanGroupedWithMeteredMinimum(): Optional = - Optional.ofNullable(newPlanGroupedWithMeteredMinimum) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newPlanMatrixWithDisplayName(): Optional = - Optional.ofNullable(newPlanMatrixWithDisplayName) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newPlanBulkWithProration(): Optional = - Optional.ofNullable(newPlanBulkWithProration) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newPlanGroupedTieredPackage(): Optional = - Optional.ofNullable(newPlanGroupedTieredPackage) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun newPlanMaxGroupTieredPackage(): Optional = - Optional.ofNullable(newPlanMaxGroupTieredPackage) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newPlanScalableMatrixWithUnitPricing(): - Optional = - Optional.ofNullable(newPlanScalableMatrixWithUnitPricing) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newPlanScalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(newPlanScalableMatrixWithTieredPricing) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newPlanCumulativeGroupedBulk(): Optional = - Optional.ofNullable(newPlanCumulativeGroupedBulk) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun isNewPlanUnit(): Boolean = newPlanUnit != null + fun isUnit(): Boolean = unit != null - fun isNewPlanPackage(): Boolean = newPlanPackage != null + fun isPackage(): Boolean = package_ != null - fun isNewPlanMatrix(): Boolean = newPlanMatrix != null + fun isMatrix(): Boolean = matrix != null - fun isNewPlanTiered(): Boolean = newPlanTiered != null + fun isTiered(): Boolean = tiered != null - fun isNewPlanTieredBps(): Boolean = newPlanTieredBps != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewPlanBps(): Boolean = newPlanBps != null + fun isBps(): Boolean = bps != null - fun isNewPlanBulkBps(): Boolean = newPlanBulkBps != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewPlanBulk(): Boolean = newPlanBulk != null + fun isBulk(): Boolean = bulk != null - fun isNewPlanThresholdTotalAmount(): Boolean = newPlanThresholdTotalAmount != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewPlanTieredPackage(): Boolean = newPlanTieredPackage != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewPlanTieredWithMinimum(): Boolean = newPlanTieredWithMinimum != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewPlanUnitWithPercent(): Boolean = newPlanUnitWithPercent != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewPlanPackageWithAllocation(): Boolean = newPlanPackageWithAllocation != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewPlanTierWithProration(): Boolean = newPlanTierWithProration != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewPlanUnitWithProration(): Boolean = newPlanUnitWithProration != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewPlanGroupedAllocation(): Boolean = newPlanGroupedAllocation != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewPlanGroupedWithProratedMinimum(): Boolean = - newPlanGroupedWithProratedMinimum != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewPlanGroupedWithMeteredMinimum(): Boolean = newPlanGroupedWithMeteredMinimum != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewPlanMatrixWithDisplayName(): Boolean = newPlanMatrixWithDisplayName != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewPlanBulkWithProration(): Boolean = newPlanBulkWithProration != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewPlanGroupedTieredPackage(): Boolean = newPlanGroupedTieredPackage != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun isNewPlanMaxGroupTieredPackage(): Boolean = newPlanMaxGroupTieredPackage != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewPlanScalableMatrixWithUnitPricing(): Boolean = - newPlanScalableMatrixWithUnitPricing != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewPlanScalableMatrixWithTieredPricing(): Boolean = - newPlanScalableMatrixWithTieredPricing != null + fun isScalableMatrixWithTieredPricing(): Boolean = scalableMatrixWithTieredPricing != null - fun isNewPlanCumulativeGroupedBulk(): Boolean = newPlanCumulativeGroupedBulk != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun asNewPlanUnit(): NewPlanUnitPrice = newPlanUnit.getOrThrow("newPlanUnit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewPlanPackage(): NewPlanPackagePrice = newPlanPackage.getOrThrow("newPlanPackage") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewPlanMatrix(): NewPlanMatrixPrice = newPlanMatrix.getOrThrow("newPlanMatrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewPlanTiered(): NewPlanTieredPrice = newPlanTiered.getOrThrow("newPlanTiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewPlanTieredBps(): NewPlanTieredBpsPrice = - newPlanTieredBps.getOrThrow("newPlanTieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewPlanBps(): NewPlanBpsPrice = newPlanBps.getOrThrow("newPlanBps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewPlanBulkBps(): NewPlanBulkBpsPrice = newPlanBulkBps.getOrThrow("newPlanBulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewPlanBulk(): NewPlanBulkPrice = newPlanBulk.getOrThrow("newPlanBulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewPlanThresholdTotalAmount(): NewPlanThresholdTotalAmountPrice = - newPlanThresholdTotalAmount.getOrThrow("newPlanThresholdTotalAmount") + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewPlanTieredPackage(): NewPlanTieredPackagePrice = - newPlanTieredPackage.getOrThrow("newPlanTieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewPlanTieredWithMinimum(): NewPlanTieredWithMinimumPrice = - newPlanTieredWithMinimum.getOrThrow("newPlanTieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewPlanUnitWithPercent(): NewPlanUnitWithPercentPrice = - newPlanUnitWithPercent.getOrThrow("newPlanUnitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewPlanPackageWithAllocation(): NewPlanPackageWithAllocationPrice = - newPlanPackageWithAllocation.getOrThrow("newPlanPackageWithAllocation") + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewPlanTierWithProration(): NewPlanTierWithProrationPrice = - newPlanTierWithProration.getOrThrow("newPlanTierWithProration") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewPlanUnitWithProration(): NewPlanUnitWithProrationPrice = - newPlanUnitWithProration.getOrThrow("newPlanUnitWithProration") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewPlanGroupedAllocation(): NewPlanGroupedAllocationPrice = - newPlanGroupedAllocation.getOrThrow("newPlanGroupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewPlanGroupedWithProratedMinimum(): NewPlanGroupedWithProratedMinimumPrice = - newPlanGroupedWithProratedMinimum.getOrThrow("newPlanGroupedWithProratedMinimum") + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewPlanGroupedWithMeteredMinimum(): NewPlanGroupedWithMeteredMinimumPrice = - newPlanGroupedWithMeteredMinimum.getOrThrow("newPlanGroupedWithMeteredMinimum") + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewPlanMatrixWithDisplayName(): NewPlanMatrixWithDisplayNamePrice = - newPlanMatrixWithDisplayName.getOrThrow("newPlanMatrixWithDisplayName") + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewPlanBulkWithProration(): NewPlanBulkWithProrationPrice = - newPlanBulkWithProration.getOrThrow("newPlanBulkWithProration") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewPlanGroupedTieredPackage(): NewPlanGroupedTieredPackagePrice = - newPlanGroupedTieredPackage.getOrThrow("newPlanGroupedTieredPackage") + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") - fun asNewPlanMaxGroupTieredPackage(): NewPlanMaxGroupTieredPackagePrice = - newPlanMaxGroupTieredPackage.getOrThrow("newPlanMaxGroupTieredPackage") + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewPlanScalableMatrixWithUnitPricing(): NewPlanScalableMatrixWithUnitPricingPrice = - newPlanScalableMatrixWithUnitPricing.getOrThrow("newPlanScalableMatrixWithUnitPricing") + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewPlanScalableMatrixWithTieredPricing(): - NewPlanScalableMatrixWithTieredPricingPrice = - newPlanScalableMatrixWithTieredPricing.getOrThrow( - "newPlanScalableMatrixWithTieredPricing" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewPlanCumulativeGroupedBulk(): NewPlanCumulativeGroupedBulkPrice = - newPlanCumulativeGroupedBulk.getOrThrow("newPlanCumulativeGroupedBulk") + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newPlanUnit != null -> visitor.visitNewPlanUnit(newPlanUnit) - newPlanPackage != null -> visitor.visitNewPlanPackage(newPlanPackage) - newPlanMatrix != null -> visitor.visitNewPlanMatrix(newPlanMatrix) - newPlanTiered != null -> visitor.visitNewPlanTiered(newPlanTiered) - newPlanTieredBps != null -> visitor.visitNewPlanTieredBps(newPlanTieredBps) - newPlanBps != null -> visitor.visitNewPlanBps(newPlanBps) - newPlanBulkBps != null -> visitor.visitNewPlanBulkBps(newPlanBulkBps) - newPlanBulk != null -> visitor.visitNewPlanBulk(newPlanBulk) - newPlanThresholdTotalAmount != null -> - visitor.visitNewPlanThresholdTotalAmount(newPlanThresholdTotalAmount) - newPlanTieredPackage != null -> - visitor.visitNewPlanTieredPackage(newPlanTieredPackage) - newPlanTieredWithMinimum != null -> - visitor.visitNewPlanTieredWithMinimum(newPlanTieredWithMinimum) - newPlanUnitWithPercent != null -> - visitor.visitNewPlanUnitWithPercent(newPlanUnitWithPercent) - newPlanPackageWithAllocation != null -> - visitor.visitNewPlanPackageWithAllocation(newPlanPackageWithAllocation) - newPlanTierWithProration != null -> - visitor.visitNewPlanTierWithProration(newPlanTierWithProration) - newPlanUnitWithProration != null -> - visitor.visitNewPlanUnitWithProration(newPlanUnitWithProration) - newPlanGroupedAllocation != null -> - visitor.visitNewPlanGroupedAllocation(newPlanGroupedAllocation) - newPlanGroupedWithProratedMinimum != null -> - visitor.visitNewPlanGroupedWithProratedMinimum( - newPlanGroupedWithProratedMinimum - ) - newPlanGroupedWithMeteredMinimum != null -> - visitor.visitNewPlanGroupedWithMeteredMinimum(newPlanGroupedWithMeteredMinimum) - newPlanMatrixWithDisplayName != null -> - visitor.visitNewPlanMatrixWithDisplayName(newPlanMatrixWithDisplayName) - newPlanBulkWithProration != null -> - visitor.visitNewPlanBulkWithProration(newPlanBulkWithProration) - newPlanGroupedTieredPackage != null -> - visitor.visitNewPlanGroupedTieredPackage(newPlanGroupedTieredPackage) - newPlanMaxGroupTieredPackage != null -> - visitor.visitNewPlanMaxGroupTieredPackage(newPlanMaxGroupTieredPackage) - newPlanScalableMatrixWithUnitPricing != null -> - visitor.visitNewPlanScalableMatrixWithUnitPricing( - newPlanScalableMatrixWithUnitPricing - ) - newPlanScalableMatrixWithTieredPricing != null -> - visitor.visitNewPlanScalableMatrixWithTieredPricing( - newPlanScalableMatrixWithTieredPricing - ) - newPlanCumulativeGroupedBulk != null -> - visitor.visitNewPlanCumulativeGroupedBulk(newPlanCumulativeGroupedBulk) + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredWithProration != null -> visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) else -> visitor.unknown(_json) } @@ -1618,140 +1498,126 @@ private constructor( accept( object : Visitor { - override fun visitNewPlanUnit(newPlanUnit: NewPlanUnitPrice) { - newPlanUnit.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewPlanPackage(newPlanPackage: NewPlanPackagePrice) { - newPlanPackage.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewPlanMatrix(newPlanMatrix: NewPlanMatrixPrice) { - newPlanMatrix.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewPlanTiered(newPlanTiered: NewPlanTieredPrice) { - newPlanTiered.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewPlanTieredBps(newPlanTieredBps: NewPlanTieredBpsPrice) { - newPlanTieredBps.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewPlanBps(newPlanBps: NewPlanBpsPrice) { - newPlanBps.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewPlanBulkBps(newPlanBulkBps: NewPlanBulkBpsPrice) { - newPlanBulkBps.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewPlanBulk(newPlanBulk: NewPlanBulkPrice) { - newPlanBulk.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewPlanThresholdTotalAmount( - newPlanThresholdTotalAmount: NewPlanThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newPlanThresholdTotalAmount.validate() + thresholdTotalAmount.validate() } - override fun visitNewPlanTieredPackage( - newPlanTieredPackage: NewPlanTieredPackagePrice - ) { - newPlanTieredPackage.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewPlanTieredWithMinimum( - newPlanTieredWithMinimum: NewPlanTieredWithMinimumPrice - ) { - newPlanTieredWithMinimum.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewPlanUnitWithPercent( - newPlanUnitWithPercent: NewPlanUnitWithPercentPrice - ) { - newPlanUnitWithPercent.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewPlanPackageWithAllocation( - newPlanPackageWithAllocation: NewPlanPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newPlanPackageWithAllocation.validate() + packageWithAllocation.validate() } - override fun visitNewPlanTierWithProration( - newPlanTierWithProration: NewPlanTierWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newPlanTierWithProration.validate() + tieredWithProration.validate() } - override fun visitNewPlanUnitWithProration( - newPlanUnitWithProration: NewPlanUnitWithProrationPrice - ) { - newPlanUnitWithProration.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewPlanGroupedAllocation( - newPlanGroupedAllocation: NewPlanGroupedAllocationPrice - ) { - newPlanGroupedAllocation.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewPlanGroupedWithProratedMinimum( - newPlanGroupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newPlanGroupedWithProratedMinimum.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewPlanGroupedWithMeteredMinimum( - newPlanGroupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newPlanGroupedWithMeteredMinimum.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewPlanMatrixWithDisplayName( - newPlanMatrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newPlanMatrixWithDisplayName.validate() + matrixWithDisplayName.validate() } - override fun visitNewPlanBulkWithProration( - newPlanBulkWithProration: NewPlanBulkWithProrationPrice - ) { - newPlanBulkWithProration.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewPlanGroupedTieredPackage( - newPlanGroupedTieredPackage: NewPlanGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newPlanGroupedTieredPackage.validate() + groupedTieredPackage.validate() } - override fun visitNewPlanMaxGroupTieredPackage( - newPlanMaxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newPlanMaxGroupTieredPackage.validate() + maxGroupTieredPackage.validate() } - override fun visitNewPlanScalableMatrixWithUnitPricing( - newPlanScalableMatrixWithUnitPricing: - NewPlanScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newPlanScalableMatrixWithUnitPricing.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewPlanScalableMatrixWithTieredPricing( - newPlanScalableMatrixWithTieredPricing: - NewPlanScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newPlanScalableMatrixWithTieredPricing.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewPlanCumulativeGroupedBulk( - newPlanCumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newPlanCumulativeGroupedBulk.validate() + cumulativeGroupedBulk.validate() } } ) @@ -1776,99 +1642,83 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewPlanUnit(newPlanUnit: NewPlanUnitPrice) = - newPlanUnit.validity() + override fun visitUnit(unit: Unit) = unit.validity() - override fun visitNewPlanPackage(newPlanPackage: NewPlanPackagePrice) = - newPlanPackage.validity() + override fun visitPackage(package_: Package) = package_.validity() - override fun visitNewPlanMatrix(newPlanMatrix: NewPlanMatrixPrice) = - newPlanMatrix.validity() + override fun visitMatrix(matrix: Matrix) = matrix.validity() - override fun visitNewPlanTiered(newPlanTiered: NewPlanTieredPrice) = - newPlanTiered.validity() + override fun visitTiered(tiered: Tiered) = tiered.validity() - override fun visitNewPlanTieredBps(newPlanTieredBps: NewPlanTieredBpsPrice) = - newPlanTieredBps.validity() + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() - override fun visitNewPlanBps(newPlanBps: NewPlanBpsPrice) = - newPlanBps.validity() + override fun visitBps(bps: Bps) = bps.validity() - override fun visitNewPlanBulkBps(newPlanBulkBps: NewPlanBulkBpsPrice) = - newPlanBulkBps.validity() + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() - override fun visitNewPlanBulk(newPlanBulk: NewPlanBulkPrice) = - newPlanBulk.validity() + override fun visitBulk(bulk: Bulk) = bulk.validity() - override fun visitNewPlanThresholdTotalAmount( - newPlanThresholdTotalAmount: NewPlanThresholdTotalAmountPrice - ) = newPlanThresholdTotalAmount.validity() + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() - override fun visitNewPlanTieredPackage( - newPlanTieredPackage: NewPlanTieredPackagePrice - ) = newPlanTieredPackage.validity() + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() - override fun visitNewPlanTieredWithMinimum( - newPlanTieredWithMinimum: NewPlanTieredWithMinimumPrice - ) = newPlanTieredWithMinimum.validity() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() - override fun visitNewPlanUnitWithPercent( - newPlanUnitWithPercent: NewPlanUnitWithPercentPrice - ) = newPlanUnitWithPercent.validity() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() - override fun visitNewPlanPackageWithAllocation( - newPlanPackageWithAllocation: NewPlanPackageWithAllocationPrice - ) = newPlanPackageWithAllocation.validity() + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() - override fun visitNewPlanTierWithProration( - newPlanTierWithProration: NewPlanTierWithProrationPrice - ) = newPlanTierWithProration.validity() + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() - override fun visitNewPlanUnitWithProration( - newPlanUnitWithProration: NewPlanUnitWithProrationPrice - ) = newPlanUnitWithProration.validity() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() - override fun visitNewPlanGroupedAllocation( - newPlanGroupedAllocation: NewPlanGroupedAllocationPrice - ) = newPlanGroupedAllocation.validity() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() - override fun visitNewPlanGroupedWithProratedMinimum( - newPlanGroupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice - ) = newPlanGroupedWithProratedMinimum.validity() + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() - override fun visitNewPlanGroupedWithMeteredMinimum( - newPlanGroupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice - ) = newPlanGroupedWithMeteredMinimum.validity() + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() - override fun visitNewPlanMatrixWithDisplayName( - newPlanMatrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice - ) = newPlanMatrixWithDisplayName.validity() + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() - override fun visitNewPlanBulkWithProration( - newPlanBulkWithProration: NewPlanBulkWithProrationPrice - ) = newPlanBulkWithProration.validity() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() - override fun visitNewPlanGroupedTieredPackage( - newPlanGroupedTieredPackage: NewPlanGroupedTieredPackagePrice - ) = newPlanGroupedTieredPackage.validity() + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() - override fun visitNewPlanMaxGroupTieredPackage( - newPlanMaxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice - ) = newPlanMaxGroupTieredPackage.validity() + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() - override fun visitNewPlanScalableMatrixWithUnitPricing( - newPlanScalableMatrixWithUnitPricing: - NewPlanScalableMatrixWithUnitPricingPrice - ) = newPlanScalableMatrixWithUnitPricing.validity() + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() - override fun visitNewPlanScalableMatrixWithTieredPricing( - newPlanScalableMatrixWithTieredPricing: - NewPlanScalableMatrixWithTieredPricingPrice - ) = newPlanScalableMatrixWithTieredPricing.validity() + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() - override fun visitNewPlanCumulativeGroupedBulk( - newPlanCumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice - ) = newPlanCumulativeGroupedBulk.validity() + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() override fun unknown(json: JsonValue?) = 0 } @@ -1879,258 +1729,199 @@ private constructor( return true } - return /* spotless:off */ other is Price && newPlanUnit == other.newPlanUnit && newPlanPackage == other.newPlanPackage && newPlanMatrix == other.newPlanMatrix && newPlanTiered == other.newPlanTiered && newPlanTieredBps == other.newPlanTieredBps && newPlanBps == other.newPlanBps && newPlanBulkBps == other.newPlanBulkBps && newPlanBulk == other.newPlanBulk && newPlanThresholdTotalAmount == other.newPlanThresholdTotalAmount && newPlanTieredPackage == other.newPlanTieredPackage && newPlanTieredWithMinimum == other.newPlanTieredWithMinimum && newPlanUnitWithPercent == other.newPlanUnitWithPercent && newPlanPackageWithAllocation == other.newPlanPackageWithAllocation && newPlanTierWithProration == other.newPlanTierWithProration && newPlanUnitWithProration == other.newPlanUnitWithProration && newPlanGroupedAllocation == other.newPlanGroupedAllocation && newPlanGroupedWithProratedMinimum == other.newPlanGroupedWithProratedMinimum && newPlanGroupedWithMeteredMinimum == other.newPlanGroupedWithMeteredMinimum && newPlanMatrixWithDisplayName == other.newPlanMatrixWithDisplayName && newPlanBulkWithProration == other.newPlanBulkWithProration && newPlanGroupedTieredPackage == other.newPlanGroupedTieredPackage && newPlanMaxGroupTieredPackage == other.newPlanMaxGroupTieredPackage && newPlanScalableMatrixWithUnitPricing == other.newPlanScalableMatrixWithUnitPricing && newPlanScalableMatrixWithTieredPricing == other.newPlanScalableMatrixWithTieredPricing && newPlanCumulativeGroupedBulk == other.newPlanCumulativeGroupedBulk /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && maxGroupTieredPackage == other.maxGroupTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPlanUnit, newPlanPackage, newPlanMatrix, newPlanTiered, newPlanTieredBps, newPlanBps, newPlanBulkBps, newPlanBulk, newPlanThresholdTotalAmount, newPlanTieredPackage, newPlanTieredWithMinimum, newPlanUnitWithPercent, newPlanPackageWithAllocation, newPlanTierWithProration, newPlanUnitWithProration, newPlanGroupedAllocation, newPlanGroupedWithProratedMinimum, newPlanGroupedWithMeteredMinimum, newPlanMatrixWithDisplayName, newPlanBulkWithProration, newPlanGroupedTieredPackage, newPlanMaxGroupTieredPackage, newPlanScalableMatrixWithUnitPricing, newPlanScalableMatrixWithTieredPricing, newPlanCumulativeGroupedBulk) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, maxGroupTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk) /* spotless:on */ override fun toString(): String = when { - newPlanUnit != null -> "Price{newPlanUnit=$newPlanUnit}" - newPlanPackage != null -> "Price{newPlanPackage=$newPlanPackage}" - newPlanMatrix != null -> "Price{newPlanMatrix=$newPlanMatrix}" - newPlanTiered != null -> "Price{newPlanTiered=$newPlanTiered}" - newPlanTieredBps != null -> "Price{newPlanTieredBps=$newPlanTieredBps}" - newPlanBps != null -> "Price{newPlanBps=$newPlanBps}" - newPlanBulkBps != null -> "Price{newPlanBulkBps=$newPlanBulkBps}" - newPlanBulk != null -> "Price{newPlanBulk=$newPlanBulk}" - newPlanThresholdTotalAmount != null -> - "Price{newPlanThresholdTotalAmount=$newPlanThresholdTotalAmount}" - newPlanTieredPackage != null -> "Price{newPlanTieredPackage=$newPlanTieredPackage}" - newPlanTieredWithMinimum != null -> - "Price{newPlanTieredWithMinimum=$newPlanTieredWithMinimum}" - newPlanUnitWithPercent != null -> - "Price{newPlanUnitWithPercent=$newPlanUnitWithPercent}" - newPlanPackageWithAllocation != null -> - "Price{newPlanPackageWithAllocation=$newPlanPackageWithAllocation}" - newPlanTierWithProration != null -> - "Price{newPlanTierWithProration=$newPlanTierWithProration}" - newPlanUnitWithProration != null -> - "Price{newPlanUnitWithProration=$newPlanUnitWithProration}" - newPlanGroupedAllocation != null -> - "Price{newPlanGroupedAllocation=$newPlanGroupedAllocation}" - newPlanGroupedWithProratedMinimum != null -> - "Price{newPlanGroupedWithProratedMinimum=$newPlanGroupedWithProratedMinimum}" - newPlanGroupedWithMeteredMinimum != null -> - "Price{newPlanGroupedWithMeteredMinimum=$newPlanGroupedWithMeteredMinimum}" - newPlanMatrixWithDisplayName != null -> - "Price{newPlanMatrixWithDisplayName=$newPlanMatrixWithDisplayName}" - newPlanBulkWithProration != null -> - "Price{newPlanBulkWithProration=$newPlanBulkWithProration}" - newPlanGroupedTieredPackage != null -> - "Price{newPlanGroupedTieredPackage=$newPlanGroupedTieredPackage}" - newPlanMaxGroupTieredPackage != null -> - "Price{newPlanMaxGroupTieredPackage=$newPlanMaxGroupTieredPackage}" - newPlanScalableMatrixWithUnitPricing != null -> - "Price{newPlanScalableMatrixWithUnitPricing=$newPlanScalableMatrixWithUnitPricing}" - newPlanScalableMatrixWithTieredPricing != null -> - "Price{newPlanScalableMatrixWithTieredPricing=$newPlanScalableMatrixWithTieredPricing}" - newPlanCumulativeGroupedBulk != null -> - "Price{newPlanCumulativeGroupedBulk=$newPlanCumulativeGroupedBulk}" + unit != null -> "Price{unit=$unit}" + package_ != null -> "Price{package_=$package_}" + matrix != null -> "Price{matrix=$matrix}" + tiered != null -> "Price{tiered=$tiered}" + tieredBps != null -> "Price{tieredBps=$tieredBps}" + bps != null -> "Price{bps=$bps}" + bulkBps != null -> "Price{bulkBps=$bulkBps}" + bulk != null -> "Price{bulk=$bulk}" + thresholdTotalAmount != null -> "Price{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" + tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" + unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" + packageWithAllocation != null -> + "Price{packageWithAllocation=$packageWithAllocation}" + tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + groupedWithMeteredMinimum != null -> + "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Price{matrixWithDisplayName=$matrixWithDisplayName}" + bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" + groupedTieredPackage != null -> "Price{groupedTieredPackage=$groupedTieredPackage}" + maxGroupTieredPackage != null -> + "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" + scalableMatrixWithUnitPricing != null -> + "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } companion object { - @JvmStatic - fun ofNewPlanUnit(newPlanUnit: NewPlanUnitPrice) = Price(newPlanUnit = newPlanUnit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofNewPlanPackage(newPlanPackage: NewPlanPackagePrice) = - Price(newPlanPackage = newPlanPackage) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic - fun ofNewPlanMatrix(newPlanMatrix: NewPlanMatrixPrice) = - Price(newPlanMatrix = newPlanMatrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) - @JvmStatic - fun ofNewPlanTiered(newPlanTiered: NewPlanTieredPrice) = - Price(newPlanTiered = newPlanTiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic - fun ofNewPlanTieredBps(newPlanTieredBps: NewPlanTieredBpsPrice) = - Price(newPlanTieredBps = newPlanTieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic - fun ofNewPlanBps(newPlanBps: NewPlanBpsPrice) = Price(newPlanBps = newPlanBps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic - fun ofNewPlanBulkBps(newPlanBulkBps: NewPlanBulkBpsPrice) = - Price(newPlanBulkBps = newPlanBulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic - fun ofNewPlanBulk(newPlanBulk: NewPlanBulkPrice) = Price(newPlanBulk = newPlanBulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofNewPlanThresholdTotalAmount( - newPlanThresholdTotalAmount: NewPlanThresholdTotalAmountPrice - ) = Price(newPlanThresholdTotalAmount = newPlanThresholdTotalAmount) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewPlanTieredPackage(newPlanTieredPackage: NewPlanTieredPackagePrice) = - Price(newPlanTieredPackage = newPlanTieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = Price(tieredPackage = tieredPackage) @JvmStatic - fun ofNewPlanTieredWithMinimum( - newPlanTieredWithMinimum: NewPlanTieredWithMinimumPrice - ) = Price(newPlanTieredWithMinimum = newPlanTieredWithMinimum) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewPlanUnitWithPercent(newPlanUnitWithPercent: NewPlanUnitWithPercentPrice) = - Price(newPlanUnitWithPercent = newPlanUnitWithPercent) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewPlanPackageWithAllocation( - newPlanPackageWithAllocation: NewPlanPackageWithAllocationPrice - ) = Price(newPlanPackageWithAllocation = newPlanPackageWithAllocation) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewPlanTierWithProration( - newPlanTierWithProration: NewPlanTierWithProrationPrice - ) = Price(newPlanTierWithProration = newPlanTierWithProration) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewPlanUnitWithProration( - newPlanUnitWithProration: NewPlanUnitWithProrationPrice - ) = Price(newPlanUnitWithProration = newPlanUnitWithProration) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Price(unitWithProration = unitWithProration) @JvmStatic - fun ofNewPlanGroupedAllocation( - newPlanGroupedAllocation: NewPlanGroupedAllocationPrice - ) = Price(newPlanGroupedAllocation = newPlanGroupedAllocation) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewPlanGroupedWithProratedMinimum( - newPlanGroupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice - ) = Price(newPlanGroupedWithProratedMinimum = newPlanGroupedWithProratedMinimum) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewPlanGroupedWithMeteredMinimum( - newPlanGroupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice - ) = Price(newPlanGroupedWithMeteredMinimum = newPlanGroupedWithMeteredMinimum) + fun ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewPlanMatrixWithDisplayName( - newPlanMatrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice - ) = Price(newPlanMatrixWithDisplayName = newPlanMatrixWithDisplayName) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewPlanBulkWithProration( - newPlanBulkWithProration: NewPlanBulkWithProrationPrice - ) = Price(newPlanBulkWithProration = newPlanBulkWithProration) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewPlanGroupedTieredPackage( - newPlanGroupedTieredPackage: NewPlanGroupedTieredPackagePrice - ) = Price(newPlanGroupedTieredPackage = newPlanGroupedTieredPackage) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Price(groupedTieredPackage = groupedTieredPackage) @JvmStatic - fun ofNewPlanMaxGroupTieredPackage( - newPlanMaxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice - ) = Price(newPlanMaxGroupTieredPackage = newPlanMaxGroupTieredPackage) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewPlanScalableMatrixWithUnitPricing( - newPlanScalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice - ) = Price(newPlanScalableMatrixWithUnitPricing = newPlanScalableMatrixWithUnitPricing) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewPlanScalableMatrixWithTieredPricing( - newPlanScalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice - ) = - Price( - newPlanScalableMatrixWithTieredPricing = newPlanScalableMatrixWithTieredPricing - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewPlanCumulativeGroupedBulk( - newPlanCumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice - ) = Price(newPlanCumulativeGroupedBulk = newPlanCumulativeGroupedBulk) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Price(cumulativeGroupedBulk = cumulativeGroupedBulk) } /** An interface that defines how to map each variant of [Price] to a value of type [T]. */ interface Visitor { - fun visitNewPlanUnit(newPlanUnit: NewPlanUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewPlanPackage(newPlanPackage: NewPlanPackagePrice): T + fun visitPackage(package_: Package): T - fun visitNewPlanMatrix(newPlanMatrix: NewPlanMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewPlanTiered(newPlanTiered: NewPlanTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewPlanTieredBps(newPlanTieredBps: NewPlanTieredBpsPrice): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewPlanBps(newPlanBps: NewPlanBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewPlanBulkBps(newPlanBulkBps: NewPlanBulkBpsPrice): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewPlanBulk(newPlanBulk: NewPlanBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewPlanThresholdTotalAmount( - newPlanThresholdTotalAmount: NewPlanThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewPlanTieredPackage(newPlanTieredPackage: NewPlanTieredPackagePrice): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewPlanTieredWithMinimum( - newPlanTieredWithMinimum: NewPlanTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewPlanUnitWithPercent(newPlanUnitWithPercent: NewPlanUnitWithPercentPrice): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewPlanPackageWithAllocation( - newPlanPackageWithAllocation: NewPlanPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewPlanTierWithProration( - newPlanTierWithProration: NewPlanTierWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewPlanUnitWithProration( - newPlanUnitWithProration: NewPlanUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewPlanGroupedAllocation( - newPlanGroupedAllocation: NewPlanGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewPlanGroupedWithProratedMinimum( - newPlanGroupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewPlanGroupedWithMeteredMinimum( - newPlanGroupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewPlanMatrixWithDisplayName( - newPlanMatrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewPlanBulkWithProration( - newPlanBulkWithProration: NewPlanBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewPlanGroupedTieredPackage( - newPlanGroupedTieredPackage: NewPlanGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T - fun visitNewPlanMaxGroupTieredPackage( - newPlanMaxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewPlanScalableMatrixWithUnitPricing( - newPlanScalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewPlanScalableMatrixWithTieredPricing( - newPlanScalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewPlanCumulativeGroupedBulk( - newPlanCumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -2156,160 +1947,132 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanUnit = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unit = it, _json = json) } ?: Price(_json = json) } "package" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanPackage = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanMatrix = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrix = it, _json = json) } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanTiered = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tiered = it, _json = json) } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanTieredBps = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredBps = it, _json = json) } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanBps = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bps = it, _json = json) } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanBulkBps = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkBps = it, _json = json) } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(newPlanBulk = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulk = it, _json = json) } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanThresholdTotalAmount = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(thresholdTotalAmount = it, _json = json) + } ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackage = it, _json = json) + } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanTieredWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithMinimum = it, _json = json) + } ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanUnitWithPercent = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithPercent = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanPackageWithAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(packageWithAllocation = it, _json = json) + } ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanTierWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithProration = it, _json = json) + } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanUnitWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanGroupedAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedAllocation = it, _json = json) + } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanGroupedWithProratedMinimum = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithProratedMinimum = it, _json = json) } ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanGroupedWithMeteredMinimum = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanMatrixWithDisplayName = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrixWithDisplayName = it, _json = json) + } ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newPlanBulkWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanGroupedTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedTieredPackage = it, _json = json) + } ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanMaxGroupTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(maxGroupTieredPackage = it, _json = json) + } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanScalableMatrixWithUnitPricing = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price(newPlanScalableMatrixWithTieredPricing = it, _json = json) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newPlanCumulativeGroupedBulk = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(cumulativeGroupedBulk = it, _json = json) + } ?: Price(_json = json) } } @@ -2325,55 +2088,53 @@ private constructor( provider: SerializerProvider, ) { when { - value.newPlanUnit != null -> generator.writeObject(value.newPlanUnit) - value.newPlanPackage != null -> generator.writeObject(value.newPlanPackage) - value.newPlanMatrix != null -> generator.writeObject(value.newPlanMatrix) - value.newPlanTiered != null -> generator.writeObject(value.newPlanTiered) - value.newPlanTieredBps != null -> generator.writeObject(value.newPlanTieredBps) - value.newPlanBps != null -> generator.writeObject(value.newPlanBps) - value.newPlanBulkBps != null -> generator.writeObject(value.newPlanBulkBps) - value.newPlanBulk != null -> generator.writeObject(value.newPlanBulk) - value.newPlanThresholdTotalAmount != null -> - generator.writeObject(value.newPlanThresholdTotalAmount) - value.newPlanTieredPackage != null -> - generator.writeObject(value.newPlanTieredPackage) - value.newPlanTieredWithMinimum != null -> - generator.writeObject(value.newPlanTieredWithMinimum) - value.newPlanUnitWithPercent != null -> - generator.writeObject(value.newPlanUnitWithPercent) - value.newPlanPackageWithAllocation != null -> - generator.writeObject(value.newPlanPackageWithAllocation) - value.newPlanTierWithProration != null -> - generator.writeObject(value.newPlanTierWithProration) - value.newPlanUnitWithProration != null -> - generator.writeObject(value.newPlanUnitWithProration) - value.newPlanGroupedAllocation != null -> - generator.writeObject(value.newPlanGroupedAllocation) - value.newPlanGroupedWithProratedMinimum != null -> - generator.writeObject(value.newPlanGroupedWithProratedMinimum) - value.newPlanGroupedWithMeteredMinimum != null -> - generator.writeObject(value.newPlanGroupedWithMeteredMinimum) - value.newPlanMatrixWithDisplayName != null -> - generator.writeObject(value.newPlanMatrixWithDisplayName) - value.newPlanBulkWithProration != null -> - generator.writeObject(value.newPlanBulkWithProration) - value.newPlanGroupedTieredPackage != null -> - generator.writeObject(value.newPlanGroupedTieredPackage) - value.newPlanMaxGroupTieredPackage != null -> - generator.writeObject(value.newPlanMaxGroupTieredPackage) - value.newPlanScalableMatrixWithUnitPricing != null -> - generator.writeObject(value.newPlanScalableMatrixWithUnitPricing) - value.newPlanScalableMatrixWithTieredPricing != null -> - generator.writeObject(value.newPlanScalableMatrixWithTieredPricing) - value.newPlanCumulativeGroupedBulk != null -> - generator.writeObject(value.newPlanCumulativeGroupedBulk) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.unitWithPercent != null -> generator.writeObject(value.unitWithPercent) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } } } - class NewPlanUnitPrice + class Unit private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -2739,7 +2500,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -2752,7 +2513,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -2775,23 +2536,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanUnitPrice: NewPlanUnitPrice) = apply { - cadence = newPlanUnitPrice.cadence - itemId = newPlanUnitPrice.itemId - modelType = newPlanUnitPrice.modelType - name = newPlanUnitPrice.name - unitConfig = newPlanUnitPrice.unitConfig - billableMetricId = newPlanUnitPrice.billableMetricId - billedInAdvance = newPlanUnitPrice.billedInAdvance - billingCycleConfiguration = newPlanUnitPrice.billingCycleConfiguration - conversionRate = newPlanUnitPrice.conversionRate - currency = newPlanUnitPrice.currency - externalPriceId = newPlanUnitPrice.externalPriceId - fixedPriceQuantity = newPlanUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanUnitPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanUnitPrice.invoicingCycleConfiguration - metadata = newPlanUnitPrice.metadata - additionalProperties = newPlanUnitPrice.additionalProperties.toMutableMap() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + currency = unit.currency + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -3133,7 +2894,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3147,8 +2908,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanUnitPrice = - NewPlanUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -3170,7 +2931,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -4386,7 +4147,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -4396,10 +4157,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewPlanPackagePrice + class Package private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -4765,7 +4526,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -4778,7 +4539,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -4801,23 +4562,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanPackagePrice: NewPlanPackagePrice) = apply { - cadence = newPlanPackagePrice.cadence - itemId = newPlanPackagePrice.itemId - modelType = newPlanPackagePrice.modelType - name = newPlanPackagePrice.name - packageConfig = newPlanPackagePrice.packageConfig - billableMetricId = newPlanPackagePrice.billableMetricId - billedInAdvance = newPlanPackagePrice.billedInAdvance - billingCycleConfiguration = newPlanPackagePrice.billingCycleConfiguration - conversionRate = newPlanPackagePrice.conversionRate - currency = newPlanPackagePrice.currency - externalPriceId = newPlanPackagePrice.externalPriceId - fixedPriceQuantity = newPlanPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanPackagePrice.invoicingCycleConfiguration - metadata = newPlanPackagePrice.metadata - additionalProperties = newPlanPackagePrice.additionalProperties.toMutableMap() + internal fun from(package_: Package) = apply { + cadence = package_.cadence + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + currency = package_.currency + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + additionalProperties = package_.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -5160,7 +4921,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5174,8 +4935,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanPackagePrice = - NewPlanPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -5197,7 +4958,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -6463,7 +6224,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -6473,10 +6234,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewPlanMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -6842,7 +6603,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -6855,7 +6616,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -6878,23 +6639,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanMatrixPrice: NewPlanMatrixPrice) = apply { - cadence = newPlanMatrixPrice.cadence - itemId = newPlanMatrixPrice.itemId - matrixConfig = newPlanMatrixPrice.matrixConfig - modelType = newPlanMatrixPrice.modelType - name = newPlanMatrixPrice.name - billableMetricId = newPlanMatrixPrice.billableMetricId - billedInAdvance = newPlanMatrixPrice.billedInAdvance - billingCycleConfiguration = newPlanMatrixPrice.billingCycleConfiguration - conversionRate = newPlanMatrixPrice.conversionRate - currency = newPlanMatrixPrice.currency - externalPriceId = newPlanMatrixPrice.externalPriceId - fixedPriceQuantity = newPlanMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanMatrixPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanMatrixPrice.invoicingCycleConfiguration - metadata = newPlanMatrixPrice.metadata - additionalProperties = newPlanMatrixPrice.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + currency = matrix.currency + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + additionalProperties = matrix.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -7237,7 +6998,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -7251,8 +7012,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanMatrixPrice = - NewPlanMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), @@ -7274,7 +7035,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -8851,7 +8612,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -8861,10 +8622,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewPlanTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -9230,7 +8991,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -9243,7 +9004,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -9266,23 +9027,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanTieredPrice: NewPlanTieredPrice) = apply { - cadence = newPlanTieredPrice.cadence - itemId = newPlanTieredPrice.itemId - modelType = newPlanTieredPrice.modelType - name = newPlanTieredPrice.name - tieredConfig = newPlanTieredPrice.tieredConfig - billableMetricId = newPlanTieredPrice.billableMetricId - billedInAdvance = newPlanTieredPrice.billedInAdvance - billingCycleConfiguration = newPlanTieredPrice.billingCycleConfiguration - conversionRate = newPlanTieredPrice.conversionRate - currency = newPlanTieredPrice.currency - externalPriceId = newPlanTieredPrice.externalPriceId - fixedPriceQuantity = newPlanTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanTieredPrice.invoicingCycleConfiguration - metadata = newPlanTieredPrice.metadata - additionalProperties = newPlanTieredPrice.additionalProperties.toMutableMap() + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + currency = tiered.currency + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + additionalProperties = tiered.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -9625,7 +9386,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9639,8 +9400,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanTieredPrice = - NewPlanTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -9662,7 +9423,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -11158,7 +10919,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -11168,10 +10929,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewPlanTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -11538,8 +11299,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -11552,7 +11312,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -11575,23 +11335,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanTieredBpsPrice: NewPlanTieredBpsPrice) = apply { - cadence = newPlanTieredBpsPrice.cadence - itemId = newPlanTieredBpsPrice.itemId - modelType = newPlanTieredBpsPrice.modelType - name = newPlanTieredBpsPrice.name - tieredBpsConfig = newPlanTieredBpsPrice.tieredBpsConfig - billableMetricId = newPlanTieredBpsPrice.billableMetricId - billedInAdvance = newPlanTieredBpsPrice.billedInAdvance - billingCycleConfiguration = newPlanTieredBpsPrice.billingCycleConfiguration - conversionRate = newPlanTieredBpsPrice.conversionRate - currency = newPlanTieredBpsPrice.currency - externalPriceId = newPlanTieredBpsPrice.externalPriceId - fixedPriceQuantity = newPlanTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanTieredBpsPrice.invoicingCycleConfiguration - metadata = newPlanTieredBpsPrice.metadata - additionalProperties = newPlanTieredBpsPrice.additionalProperties.toMutableMap() + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + currency = tieredBps.currency + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + additionalProperties = tieredBps.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -11934,7 +11694,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11948,8 +11708,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanTieredBpsPrice = - NewPlanTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -11971,7 +11731,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -13515,7 +13275,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -13525,10 +13285,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewPlanBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -13894,7 +13654,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -13907,7 +13667,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -13930,23 +13690,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanBpsPrice: NewPlanBpsPrice) = apply { - bpsConfig = newPlanBpsPrice.bpsConfig - cadence = newPlanBpsPrice.cadence - itemId = newPlanBpsPrice.itemId - modelType = newPlanBpsPrice.modelType - name = newPlanBpsPrice.name - billableMetricId = newPlanBpsPrice.billableMetricId - billedInAdvance = newPlanBpsPrice.billedInAdvance - billingCycleConfiguration = newPlanBpsPrice.billingCycleConfiguration - conversionRate = newPlanBpsPrice.conversionRate - currency = newPlanBpsPrice.currency - externalPriceId = newPlanBpsPrice.externalPriceId - fixedPriceQuantity = newPlanBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanBpsPrice.invoicingCycleConfiguration - metadata = newPlanBpsPrice.metadata - additionalProperties = newPlanBpsPrice.additionalProperties.toMutableMap() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + currency = bps.currency + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -14288,7 +14048,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -14302,8 +14062,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanBpsPrice = - NewPlanBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -14325,7 +14085,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -15585,7 +15345,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -15595,10 +15355,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewPlanBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -15964,7 +15724,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -15977,7 +15737,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -16000,23 +15760,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanBulkBpsPrice: NewPlanBulkBpsPrice) = apply { - bulkBpsConfig = newPlanBulkBpsPrice.bulkBpsConfig - cadence = newPlanBulkBpsPrice.cadence - itemId = newPlanBulkBpsPrice.itemId - modelType = newPlanBulkBpsPrice.modelType - name = newPlanBulkBpsPrice.name - billableMetricId = newPlanBulkBpsPrice.billableMetricId - billedInAdvance = newPlanBulkBpsPrice.billedInAdvance - billingCycleConfiguration = newPlanBulkBpsPrice.billingCycleConfiguration - conversionRate = newPlanBulkBpsPrice.conversionRate - currency = newPlanBulkBpsPrice.currency - externalPriceId = newPlanBulkBpsPrice.externalPriceId - fixedPriceQuantity = newPlanBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBulkBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanBulkBpsPrice.invoicingCycleConfiguration - metadata = newPlanBulkBpsPrice.metadata - additionalProperties = newPlanBulkBpsPrice.additionalProperties.toMutableMap() + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + currency = bulkBps.currency + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + additionalProperties = bulkBps.additionalProperties.toMutableMap() } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = @@ -16359,7 +16119,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -16373,8 +16133,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanBulkBpsPrice = - NewPlanBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -16396,7 +16156,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -17895,7 +17655,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -17905,10 +17665,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewPlanBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -18274,7 +18034,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewPlanBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -18287,7 +18047,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -18310,23 +18070,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanBulkPrice: NewPlanBulkPrice) = apply { - bulkConfig = newPlanBulkPrice.bulkConfig - cadence = newPlanBulkPrice.cadence - itemId = newPlanBulkPrice.itemId - modelType = newPlanBulkPrice.modelType - name = newPlanBulkPrice.name - billableMetricId = newPlanBulkPrice.billableMetricId - billedInAdvance = newPlanBulkPrice.billedInAdvance - billingCycleConfiguration = newPlanBulkPrice.billingCycleConfiguration - conversionRate = newPlanBulkPrice.conversionRate - currency = newPlanBulkPrice.currency - externalPriceId = newPlanBulkPrice.externalPriceId - fixedPriceQuantity = newPlanBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBulkPrice.invoiceGroupingKey - invoicingCycleConfiguration = newPlanBulkPrice.invoicingCycleConfiguration - metadata = newPlanBulkPrice.metadata - additionalProperties = newPlanBulkPrice.additionalProperties.toMutableMap() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + currency = bulk.currency + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -18668,7 +18428,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -18682,8 +18442,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanBulkPrice = - NewPlanBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -18705,7 +18465,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -20161,7 +19921,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -20171,10 +19931,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewPlanThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -20543,8 +20303,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanThresholdTotalAmountPrice]. + * Returns a mutable builder for constructing an instance of [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -20557,7 +20316,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -20581,29 +20340,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanThresholdTotalAmountPrice: NewPlanThresholdTotalAmountPrice - ) = apply { - cadence = newPlanThresholdTotalAmountPrice.cadence - itemId = newPlanThresholdTotalAmountPrice.itemId - modelType = newPlanThresholdTotalAmountPrice.modelType - name = newPlanThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newPlanThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newPlanThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newPlanThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newPlanThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newPlanThresholdTotalAmountPrice.conversionRate - currency = newPlanThresholdTotalAmountPrice.currency - externalPriceId = newPlanThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = newPlanThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanThresholdTotalAmountPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newPlanThresholdTotalAmountPrice.metadata - additionalProperties = - newPlanThresholdTotalAmountPrice.additionalProperties.toMutableMap() + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + currency = thresholdTotalAmount.currency + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey + invoicingCycleConfiguration = thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata + additionalProperties = thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -20947,7 +20700,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -20961,8 +20714,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanThresholdTotalAmountPrice = - NewPlanThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -20984,7 +20737,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -22143,7 +21896,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -22153,10 +21906,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewPlanTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -22523,8 +22276,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -22537,7 +22289,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -22560,25 +22312,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanTieredPackagePrice: NewPlanTieredPackagePrice) = apply { - cadence = newPlanTieredPackagePrice.cadence - itemId = newPlanTieredPackagePrice.itemId - modelType = newPlanTieredPackagePrice.modelType - name = newPlanTieredPackagePrice.name - tieredPackageConfig = newPlanTieredPackagePrice.tieredPackageConfig - billableMetricId = newPlanTieredPackagePrice.billableMetricId - billedInAdvance = newPlanTieredPackagePrice.billedInAdvance - billingCycleConfiguration = newPlanTieredPackagePrice.billingCycleConfiguration - conversionRate = newPlanTieredPackagePrice.conversionRate - currency = newPlanTieredPackagePrice.currency - externalPriceId = newPlanTieredPackagePrice.externalPriceId - fixedPriceQuantity = newPlanTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanTieredPackagePrice.invoicingCycleConfiguration - metadata = newPlanTieredPackagePrice.metadata - additionalProperties = - newPlanTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + currency = tieredPackage.currency + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -22922,7 +22672,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -22936,8 +22686,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanTieredPackagePrice = - NewPlanTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -22959,7 +22709,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -24117,7 +23867,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -24127,10 +23877,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewPlanTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -24498,8 +24248,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanTieredWithMinimumPrice]. + * Returns a mutable builder for constructing an instance of [TieredWithMinimum]. * * The following fields are required: * ```java @@ -24512,7 +24261,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -24535,29 +24284,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanTieredWithMinimumPrice: NewPlanTieredWithMinimumPrice) = - apply { - cadence = newPlanTieredWithMinimumPrice.cadence - itemId = newPlanTieredWithMinimumPrice.itemId - modelType = newPlanTieredWithMinimumPrice.modelType - name = newPlanTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newPlanTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newPlanTieredWithMinimumPrice.billableMetricId - billedInAdvance = newPlanTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newPlanTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newPlanTieredWithMinimumPrice.conversionRate - currency = newPlanTieredWithMinimumPrice.currency - externalPriceId = newPlanTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = newPlanTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newPlanTieredWithMinimumPrice.metadata - additionalProperties = - newPlanTieredWithMinimumPrice.additionalProperties.toMutableMap() - } + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + currency = tieredWithMinimum.currency + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -24899,7 +24643,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -24913,8 +24657,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanTieredWithMinimumPrice = - NewPlanTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -24936,7 +24680,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -26094,7 +25838,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -26104,10 +25848,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewPlanUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -26474,8 +26218,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -26488,7 +26231,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -26511,28 +26254,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @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() - } + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + currency = unitWithPercent.currency + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -26875,7 +26614,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -26889,8 +26628,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanUnitWithPercentPrice = - NewPlanUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -26912,7 +26651,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -28070,7 +27809,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -28080,10 +27819,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewPlanPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -28453,7 +28192,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -28466,7 +28205,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -28490,29 +28229,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanPackageWithAllocationPrice: NewPlanPackageWithAllocationPrice - ) = apply { - cadence = newPlanPackageWithAllocationPrice.cadence - itemId = newPlanPackageWithAllocationPrice.itemId - modelType = newPlanPackageWithAllocationPrice.modelType - name = newPlanPackageWithAllocationPrice.name - packageWithAllocationConfig = - newPlanPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = newPlanPackageWithAllocationPrice.billableMetricId - billedInAdvance = newPlanPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newPlanPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newPlanPackageWithAllocationPrice.conversionRate - currency = newPlanPackageWithAllocationPrice.currency - externalPriceId = newPlanPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = newPlanPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanPackageWithAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newPlanPackageWithAllocationPrice.metadata - additionalProperties = - newPlanPackageWithAllocationPrice.additionalProperties.toMutableMap() + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name + packageWithAllocationConfig = packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + currency = packageWithAllocation.currency + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey + invoicingCycleConfiguration = packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata + additionalProperties = packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -28856,7 +28589,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -28870,8 +28603,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanPackageWithAllocationPrice = - NewPlanPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -28893,7 +28626,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -30054,7 +29787,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -30064,10 +29797,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewPlanTierWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -30435,8 +30168,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanTierWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [TieredWithProration]. * * The following fields are required: * ```java @@ -30449,7 +30181,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanTierWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -30472,29 +30204,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanTierWithProrationPrice: NewPlanTierWithProrationPrice) = - apply { - cadence = newPlanTierWithProrationPrice.cadence - itemId = newPlanTierWithProrationPrice.itemId - modelType = newPlanTierWithProrationPrice.modelType - name = newPlanTierWithProrationPrice.name - tieredWithProrationConfig = - newPlanTierWithProrationPrice.tieredWithProrationConfig - billableMetricId = newPlanTierWithProrationPrice.billableMetricId - billedInAdvance = newPlanTierWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newPlanTierWithProrationPrice.billingCycleConfiguration - conversionRate = newPlanTierWithProrationPrice.conversionRate - currency = newPlanTierWithProrationPrice.currency - externalPriceId = newPlanTierWithProrationPrice.externalPriceId - fixedPriceQuantity = newPlanTierWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTierWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanTierWithProrationPrice.invoicingCycleConfiguration - metadata = newPlanTierWithProrationPrice.metadata - additionalProperties = - newPlanTierWithProrationPrice.additionalProperties.toMutableMap() - } + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + currency = tieredWithProration.currency + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata + additionalProperties = tieredWithProration.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -30837,7 +30564,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanTierWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -30851,8 +30578,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanTierWithProrationPrice = - NewPlanTierWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -30874,7 +30601,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanTierWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -32033,7 +31760,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -32043,10 +31770,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewPlanUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -32414,8 +32141,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanUnitWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithProration]. * * The following fields are required: * ```java @@ -32428,7 +32154,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -32451,29 +32177,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanUnitWithProrationPrice: NewPlanUnitWithProrationPrice) = - apply { - cadence = newPlanUnitWithProrationPrice.cadence - itemId = newPlanUnitWithProrationPrice.itemId - modelType = newPlanUnitWithProrationPrice.modelType - name = newPlanUnitWithProrationPrice.name - unitWithProrationConfig = - newPlanUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newPlanUnitWithProrationPrice.billableMetricId - billedInAdvance = newPlanUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newPlanUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newPlanUnitWithProrationPrice.conversionRate - currency = newPlanUnitWithProrationPrice.currency - externalPriceId = newPlanUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = newPlanUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newPlanUnitWithProrationPrice.metadata - additionalProperties = - newPlanUnitWithProrationPrice.additionalProperties.toMutableMap() - } + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + currency = unitWithProration.currency + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + additionalProperties = unitWithProration.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -32815,7 +32536,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -32829,8 +32550,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanUnitWithProrationPrice = - NewPlanUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -32852,7 +32573,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -34010,7 +33731,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -34020,10 +33741,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewPlanGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, @@ -34391,8 +34112,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanGroupedAllocationPrice]. + * Returns a mutable builder for constructing an instance of [GroupedAllocation]. * * The following fields are required: * ```java @@ -34405,7 +34125,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -34428,29 +34148,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanGroupedAllocationPrice: NewPlanGroupedAllocationPrice) = - apply { - cadence = newPlanGroupedAllocationPrice.cadence - groupedAllocationConfig = - newPlanGroupedAllocationPrice.groupedAllocationConfig - itemId = newPlanGroupedAllocationPrice.itemId - modelType = newPlanGroupedAllocationPrice.modelType - name = newPlanGroupedAllocationPrice.name - billableMetricId = newPlanGroupedAllocationPrice.billableMetricId - billedInAdvance = newPlanGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newPlanGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newPlanGroupedAllocationPrice.conversionRate - currency = newPlanGroupedAllocationPrice.currency - externalPriceId = newPlanGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = newPlanGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newPlanGroupedAllocationPrice.metadata - additionalProperties = - newPlanGroupedAllocationPrice.additionalProperties.toMutableMap() - } + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + currency = groupedAllocation.currency + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -34792,7 +34507,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -34806,8 +34521,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanGroupedAllocationPrice = - NewPlanGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), @@ -34829,7 +34544,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -35987,7 +35702,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -35997,10 +35712,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewPlanGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val groupedWithProratedMinimumConfig: @@ -36371,7 +36086,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -36384,7 +36099,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -36409,29 +36124,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanGroupedWithProratedMinimumPrice: NewPlanGroupedWithProratedMinimumPrice - ) = apply { - cadence = newPlanGroupedWithProratedMinimumPrice.cadence + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = apply { + cadence = groupedWithProratedMinimum.cadence groupedWithProratedMinimumConfig = - newPlanGroupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig - itemId = newPlanGroupedWithProratedMinimumPrice.itemId - modelType = newPlanGroupedWithProratedMinimumPrice.modelType - name = newPlanGroupedWithProratedMinimumPrice.name - billableMetricId = newPlanGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = newPlanGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newPlanGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = newPlanGroupedWithProratedMinimumPrice.conversionRate - currency = newPlanGroupedWithProratedMinimumPrice.currency - externalPriceId = newPlanGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = newPlanGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedWithProratedMinimumPrice.invoiceGroupingKey + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + currency = groupedWithProratedMinimum.currency + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey invoicingCycleConfiguration = - newPlanGroupedWithProratedMinimumPrice.invoicingCycleConfiguration - metadata = newPlanGroupedWithProratedMinimumPrice.metadata + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata additionalProperties = - newPlanGroupedWithProratedMinimumPrice.additionalProperties.toMutableMap() + groupedWithProratedMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -36777,7 +36489,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -36791,8 +36503,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanGroupedWithProratedMinimumPrice = - NewPlanGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", @@ -36817,7 +36529,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -37979,7 +37691,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -37989,10 +37701,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewPlanGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val groupedWithMeteredMinimumConfig: JsonField, @@ -38362,7 +38074,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -38375,7 +38087,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -38400,29 +38112,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanGroupedWithMeteredMinimumPrice: NewPlanGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newPlanGroupedWithMeteredMinimumPrice.cadence + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = apply { + cadence = groupedWithMeteredMinimum.cadence groupedWithMeteredMinimumConfig = - newPlanGroupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig - itemId = newPlanGroupedWithMeteredMinimumPrice.itemId - modelType = newPlanGroupedWithMeteredMinimumPrice.modelType - name = newPlanGroupedWithMeteredMinimumPrice.name - billableMetricId = newPlanGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = newPlanGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newPlanGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = newPlanGroupedWithMeteredMinimumPrice.conversionRate - currency = newPlanGroupedWithMeteredMinimumPrice.currency - externalPriceId = newPlanGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = newPlanGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedWithMeteredMinimumPrice.invoiceGroupingKey + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + currency = groupedWithMeteredMinimum.currency + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey invoicingCycleConfiguration = - newPlanGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration - metadata = newPlanGroupedWithMeteredMinimumPrice.metadata + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata additionalProperties = - newPlanGroupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() + groupedWithMeteredMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -38766,7 +38475,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -38780,8 +38489,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanGroupedWithMeteredMinimumPrice = - NewPlanGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithMeteredMinimumConfig", @@ -38806,7 +38515,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -39968,7 +39677,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 */ @@ -39978,10 +39687,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithMeteredMinimum{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}" } - class NewPlanMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -40351,7 +40060,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -40364,7 +40073,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -40388,29 +40097,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanMatrixWithDisplayNamePrice: NewPlanMatrixWithDisplayNamePrice - ) = apply { - cadence = newPlanMatrixWithDisplayNamePrice.cadence - itemId = newPlanMatrixWithDisplayNamePrice.itemId - matrixWithDisplayNameConfig = - newPlanMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newPlanMatrixWithDisplayNamePrice.modelType - name = newPlanMatrixWithDisplayNamePrice.name - billableMetricId = newPlanMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newPlanMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newPlanMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newPlanMatrixWithDisplayNamePrice.conversionRate - currency = newPlanMatrixWithDisplayNamePrice.currency - externalPriceId = newPlanMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = newPlanMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanMatrixWithDisplayNamePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newPlanMatrixWithDisplayNamePrice.metadata - additionalProperties = - newPlanMatrixWithDisplayNamePrice.additionalProperties.toMutableMap() + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + itemId = matrixWithDisplayName.itemId + matrixWithDisplayNameConfig = matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + currency = matrixWithDisplayName.currency + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey + invoicingCycleConfiguration = matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata + additionalProperties = matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -40754,7 +40457,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -40768,8 +40471,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanMatrixWithDisplayNamePrice = - NewPlanMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), @@ -40791,7 +40494,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -41952,7 +41655,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 */ @@ -41962,10 +41665,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "MatrixWithDisplayName{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}" } - class NewPlanBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -42333,8 +42036,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanBulkWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [BulkWithProration]. * * The following fields are required: * ```java @@ -42347,7 +42049,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -42370,29 +42072,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPlanBulkWithProrationPrice: NewPlanBulkWithProrationPrice) = - apply { - bulkWithProrationConfig = - newPlanBulkWithProrationPrice.bulkWithProrationConfig - cadence = newPlanBulkWithProrationPrice.cadence - itemId = newPlanBulkWithProrationPrice.itemId - modelType = newPlanBulkWithProrationPrice.modelType - name = newPlanBulkWithProrationPrice.name - billableMetricId = newPlanBulkWithProrationPrice.billableMetricId - billedInAdvance = newPlanBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newPlanBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newPlanBulkWithProrationPrice.conversionRate - currency = newPlanBulkWithProrationPrice.currency - externalPriceId = newPlanBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = newPlanBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newPlanBulkWithProrationPrice.metadata - additionalProperties = - newPlanBulkWithProrationPrice.additionalProperties.toMutableMap() - } + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + currency = bulkWithProration.currency + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() + } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) @@ -42734,7 +42431,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -42748,8 +42445,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanBulkWithProrationPrice = - NewPlanBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -42771,7 +42468,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -43929,7 +43626,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -43939,10 +43636,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewPlanGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, @@ -44311,8 +44008,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewPlanGroupedTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -44325,7 +44021,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -44349,29 +44045,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice - ) = apply { - cadence = newPlanGroupedTieredPackagePrice.cadence - groupedTieredPackageConfig = - newPlanGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newPlanGroupedTieredPackagePrice.itemId - modelType = newPlanGroupedTieredPackagePrice.modelType - name = newPlanGroupedTieredPackagePrice.name - billableMetricId = newPlanGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newPlanGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newPlanGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newPlanGroupedTieredPackagePrice.conversionRate - currency = newPlanGroupedTieredPackagePrice.currency - externalPriceId = newPlanGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = newPlanGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newPlanGroupedTieredPackagePrice.metadata - additionalProperties = - newPlanGroupedTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + currency = groupedTieredPackage.currency + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata + additionalProperties = groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -44715,7 +44405,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -44729,8 +44419,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanGroupedTieredPackagePrice = - NewPlanGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), @@ -44752,7 +44442,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -45911,7 +45601,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedTieredPackage && 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 */ @@ -45921,10 +45611,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedTieredPackage{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}" } - class NewPlanMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -46294,7 +45984,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -46307,7 +45997,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -46331,29 +46021,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanMaxGroupTieredPackagePrice: NewPlanMaxGroupTieredPackagePrice - ) = apply { - cadence = newPlanMaxGroupTieredPackagePrice.cadence - itemId = newPlanMaxGroupTieredPackagePrice.itemId - maxGroupTieredPackageConfig = - newPlanMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newPlanMaxGroupTieredPackagePrice.modelType - name = newPlanMaxGroupTieredPackagePrice.name - billableMetricId = newPlanMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newPlanMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newPlanMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newPlanMaxGroupTieredPackagePrice.conversionRate - currency = newPlanMaxGroupTieredPackagePrice.currency - externalPriceId = newPlanMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = newPlanMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanMaxGroupTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newPlanMaxGroupTieredPackagePrice.metadata - additionalProperties = - newPlanMaxGroupTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + itemId = maxGroupTieredPackage.itemId + maxGroupTieredPackageConfig = maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + currency = maxGroupTieredPackage.currency + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata + additionalProperties = maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -46697,7 +46381,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -46711,8 +46395,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanMaxGroupTieredPackagePrice = - NewPlanMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("maxGroupTieredPackageConfig", maxGroupTieredPackageConfig), @@ -46734,7 +46418,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -47895,7 +47579,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -47905,10 +47589,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" + "MaxGroupTieredPackage{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" } - class NewPlanScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -48282,7 +47966,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -48295,7 +47979,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -48321,35 +48005,29 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanScalableMatrixWithUnitPricingPrice: - NewPlanScalableMatrixWithUnitPricingPrice - ) = apply { - cadence = newPlanScalableMatrixWithUnitPricingPrice.cadence - itemId = newPlanScalableMatrixWithUnitPricingPrice.itemId - modelType = newPlanScalableMatrixWithUnitPricingPrice.modelType - name = newPlanScalableMatrixWithUnitPricingPrice.name - scalableMatrixWithUnitPricingConfig = - newPlanScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = newPlanScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = newPlanScalableMatrixWithUnitPricingPrice.billedInAdvance - billingCycleConfiguration = - newPlanScalableMatrixWithUnitPricingPrice.billingCycleConfiguration - conversionRate = newPlanScalableMatrixWithUnitPricingPrice.conversionRate - currency = newPlanScalableMatrixWithUnitPricingPrice.currency - externalPriceId = newPlanScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newPlanScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newPlanScalableMatrixWithUnitPricingPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanScalableMatrixWithUnitPricingPrice.invoicingCycleConfiguration - metadata = newPlanScalableMatrixWithUnitPricingPrice.metadata - additionalProperties = - newPlanScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() - } + internal fun from(scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing) = + apply { + cadence = scalableMatrixWithUnitPricing.cadence + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name + scalableMatrixWithUnitPricingConfig = + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance + billingCycleConfiguration = + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + currency = scalableMatrixWithUnitPricing.currency + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey + invoicingCycleConfiguration = + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata + additionalProperties = + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -48698,7 +48376,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -48712,8 +48390,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanScalableMatrixWithUnitPricingPrice = - NewPlanScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -48738,7 +48416,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -49900,7 +49578,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -49910,10 +49588,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewPlanScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -50288,7 +49966,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -50301,7 +49979,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -50328,33 +50006,28 @@ private constructor( @JvmSynthetic internal fun from( - newPlanScalableMatrixWithTieredPricingPrice: - NewPlanScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newPlanScalableMatrixWithTieredPricingPrice.cadence - itemId = newPlanScalableMatrixWithTieredPricingPrice.itemId - modelType = newPlanScalableMatrixWithTieredPricingPrice.modelType - name = newPlanScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newPlanScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = newPlanScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = newPlanScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newPlanScalableMatrixWithTieredPricingPrice.billingCycleConfiguration - conversionRate = newPlanScalableMatrixWithTieredPricingPrice.conversionRate - currency = newPlanScalableMatrixWithTieredPricingPrice.currency - externalPriceId = newPlanScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newPlanScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newPlanScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + currency = scalableMatrixWithTieredPricing.currency + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newPlanScalableMatrixWithTieredPricingPrice.invoicingCycleConfiguration - metadata = newPlanScalableMatrixWithTieredPricingPrice.metadata + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata additionalProperties = - newPlanScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -50705,7 +50378,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -50719,8 +50392,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanScalableMatrixWithTieredPricingPrice = - NewPlanScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -50745,7 +50418,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -51908,7 +51581,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -51918,10 +51591,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewPlanCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -52291,7 +51964,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPlanCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -52304,7 +51977,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPlanCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -52328,29 +52001,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newPlanCumulativeGroupedBulkPrice: NewPlanCumulativeGroupedBulkPrice - ) = apply { - cadence = newPlanCumulativeGroupedBulkPrice.cadence - cumulativeGroupedBulkConfig = - newPlanCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - itemId = newPlanCumulativeGroupedBulkPrice.itemId - modelType = newPlanCumulativeGroupedBulkPrice.modelType - name = newPlanCumulativeGroupedBulkPrice.name - billableMetricId = newPlanCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newPlanCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newPlanCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newPlanCumulativeGroupedBulkPrice.conversionRate - currency = newPlanCumulativeGroupedBulkPrice.currency - externalPriceId = newPlanCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = newPlanCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanCumulativeGroupedBulkPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newPlanCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newPlanCumulativeGroupedBulkPrice.metadata - additionalProperties = - newPlanCumulativeGroupedBulkPrice.additionalProperties.toMutableMap() + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence + cumulativeGroupedBulkConfig = cumulativeGroupedBulk.cumulativeGroupedBulkConfig + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + currency = cumulativeGroupedBulk.currency + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey + invoicingCycleConfiguration = cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata + additionalProperties = cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -52694,7 +52361,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPlanCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -52708,8 +52375,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPlanCumulativeGroupedBulkPrice = - NewPlanCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired("cumulativeGroupedBulkConfig", cumulativeGroupedBulkConfig), checkRequired("itemId", itemId), @@ -52731,7 +52398,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPlanCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -53892,7 +53559,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -53902,7 +53569,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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/Price.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt index 055f70b08..7d170375d 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 @@ -47,113 +47,109 @@ import kotlin.jvm.optionals.getOrNull @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val unit: UnitPrice? = null, - private val packagePrice: PackagePrice? = null, - private val matrix: MatrixPrice? = null, - private val tiered: TieredPrice? = null, - private val tieredBps: TieredBpsPrice? = null, - private val bps: BpsPrice? = null, - private val bulkBps: BulkBpsPrice? = null, - private val bulk: BulkPrice? = null, - private val thresholdTotalAmount: ThresholdTotalAmountPrice? = null, - private val tieredPackage: TieredPackagePrice? = null, - private val groupedTiered: GroupedTieredPrice? = null, - private val tieredWithMinimum: TieredWithMinimumPrice? = null, - private val tieredPackageWithMinimum: TieredPackageWithMinimumPrice? = null, - private val packageWithAllocation: PackageWithAllocationPrice? = null, - private val unitWithPercent: UnitWithPercentPrice? = null, - private val matrixWithAllocation: MatrixWithAllocationPrice? = null, - private val tieredWithProration: TieredWithProrationPrice? = null, - private val unitWithProration: UnitWithProrationPrice? = null, - private val groupedAllocation: GroupedAllocationPrice? = null, - private val groupedWithProratedMinimum: GroupedWithProratedMinimumPrice? = null, - private val groupedWithMeteredMinimum: GroupedWithMeteredMinimumPrice? = null, - private val matrixWithDisplayName: MatrixWithDisplayNamePrice? = null, - private val bulkWithProration: BulkWithProrationPrice? = null, - private val groupedTieredPackage: GroupedTieredPackagePrice? = null, - private val maxGroupTieredPackage: MaxGroupTieredPackagePrice? = null, - private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricingPrice? = null, - private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricingPrice? = null, - private val cumulativeGroupedBulk: CumulativeGroupedBulkPrice? = null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val groupedTiered: GroupedTiered? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val tieredPackageWithMinimum: TieredPackageWithMinimum? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val matrixWithAllocation: MatrixWithAllocation? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val bulkWithProration: BulkWithProration? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, private val _json: JsonValue? = null, ) { - fun unit(): Optional = Optional.ofNullable(unit) + fun unit(): Optional = Optional.ofNullable(unit) - fun packagePrice(): Optional = Optional.ofNullable(packagePrice) + fun package_(): Optional = Optional.ofNullable(package_) - fun matrix(): Optional = Optional.ofNullable(matrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun tiered(): Optional = Optional.ofNullable(tiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun tieredBps(): Optional = Optional.ofNullable(tieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun bps(): Optional = Optional.ofNullable(bps) + fun bps(): Optional = Optional.ofNullable(bps) - fun bulkBps(): Optional = Optional.ofNullable(bulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun bulk(): Optional = Optional.ofNullable(bulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun thresholdTotalAmount(): Optional = + fun thresholdTotalAmount(): Optional = Optional.ofNullable(thresholdTotalAmount) - fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun groupedTiered(): Optional = Optional.ofNullable(groupedTiered) + fun groupedTiered(): Optional = Optional.ofNullable(groupedTiered) - fun tieredWithMinimum(): Optional = - Optional.ofNullable(tieredWithMinimum) + fun tieredWithMinimum(): Optional = Optional.ofNullable(tieredWithMinimum) - fun tieredPackageWithMinimum(): Optional = + fun tieredPackageWithMinimum(): Optional = Optional.ofNullable(tieredPackageWithMinimum) - fun packageWithAllocation(): Optional = + fun packageWithAllocation(): Optional = Optional.ofNullable(packageWithAllocation) - fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun matrixWithAllocation(): Optional = + fun matrixWithAllocation(): Optional = Optional.ofNullable(matrixWithAllocation) - fun tieredWithProration(): Optional = + fun tieredWithProration(): Optional = Optional.ofNullable(tieredWithProration) - fun unitWithProration(): Optional = - Optional.ofNullable(unitWithProration) + fun unitWithProration(): Optional = Optional.ofNullable(unitWithProration) - fun groupedAllocation(): Optional = - Optional.ofNullable(groupedAllocation) + fun groupedAllocation(): Optional = Optional.ofNullable(groupedAllocation) - fun groupedWithProratedMinimum(): Optional = + fun groupedWithProratedMinimum(): Optional = Optional.ofNullable(groupedWithProratedMinimum) - fun groupedWithMeteredMinimum(): Optional = + fun groupedWithMeteredMinimum(): Optional = Optional.ofNullable(groupedWithMeteredMinimum) - fun matrixWithDisplayName(): Optional = + fun matrixWithDisplayName(): Optional = Optional.ofNullable(matrixWithDisplayName) - fun bulkWithProration(): Optional = - Optional.ofNullable(bulkWithProration) + fun bulkWithProration(): Optional = Optional.ofNullable(bulkWithProration) - fun groupedTieredPackage(): Optional = + fun groupedTieredPackage(): Optional = Optional.ofNullable(groupedTieredPackage) - fun maxGroupTieredPackage(): Optional = + fun maxGroupTieredPackage(): Optional = Optional.ofNullable(maxGroupTieredPackage) - fun scalableMatrixWithUnitPricing(): Optional = + fun scalableMatrixWithUnitPricing(): Optional = Optional.ofNullable(scalableMatrixWithUnitPricing) - fun scalableMatrixWithTieredPricing(): Optional = + fun scalableMatrixWithTieredPricing(): Optional = Optional.ofNullable(scalableMatrixWithTieredPricing) - fun cumulativeGroupedBulk(): Optional = + fun cumulativeGroupedBulk(): Optional = Optional.ofNullable(cumulativeGroupedBulk) fun isUnit(): Boolean = unit != null - fun isPackagePrice(): Boolean = packagePrice != null + fun isPackage(): Boolean = package_ != null fun isMatrix(): Boolean = matrix != null @@ -207,77 +203,73 @@ private constructor( fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun asUnit(): UnitPrice = unit.getOrThrow("unit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asPackagePrice(): PackagePrice = packagePrice.getOrThrow("packagePrice") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asMatrix(): MatrixPrice = matrix.getOrThrow("matrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asTiered(): TieredPrice = tiered.getOrThrow("tiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asTieredBps(): TieredBpsPrice = tieredBps.getOrThrow("tieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asBps(): BpsPrice = bps.getOrThrow("bps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asBulkBps(): BulkBpsPrice = bulkBps.getOrThrow("bulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asBulk(): BulkPrice = bulk.getOrThrow("bulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asThresholdTotalAmount(): ThresholdTotalAmountPrice = + fun asThresholdTotalAmount(): ThresholdTotalAmount = thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asTieredPackage(): TieredPackagePrice = tieredPackage.getOrThrow("tieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asGroupedTiered(): GroupedTieredPrice = groupedTiered.getOrThrow("groupedTiered") + fun asGroupedTiered(): GroupedTiered = groupedTiered.getOrThrow("groupedTiered") - fun asTieredWithMinimum(): TieredWithMinimumPrice = - tieredWithMinimum.getOrThrow("tieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asTieredPackageWithMinimum(): TieredPackageWithMinimumPrice = + fun asTieredPackageWithMinimum(): TieredPackageWithMinimum = tieredPackageWithMinimum.getOrThrow("tieredPackageWithMinimum") - fun asPackageWithAllocation(): PackageWithAllocationPrice = + fun asPackageWithAllocation(): PackageWithAllocation = packageWithAllocation.getOrThrow("packageWithAllocation") - fun asUnitWithPercent(): UnitWithPercentPrice = unitWithPercent.getOrThrow("unitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asMatrixWithAllocation(): MatrixWithAllocationPrice = + fun asMatrixWithAllocation(): MatrixWithAllocation = matrixWithAllocation.getOrThrow("matrixWithAllocation") - fun asTieredWithProration(): TieredWithProrationPrice = + fun asTieredWithProration(): TieredWithProration = tieredWithProration.getOrThrow("tieredWithProration") - fun asUnitWithProration(): UnitWithProrationPrice = - unitWithProration.getOrThrow("unitWithProration") + fun asUnitWithProration(): UnitWithProration = unitWithProration.getOrThrow("unitWithProration") - fun asGroupedAllocation(): GroupedAllocationPrice = - groupedAllocation.getOrThrow("groupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = groupedAllocation.getOrThrow("groupedAllocation") - fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimumPrice = + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimumPrice = + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asMatrixWithDisplayName(): MatrixWithDisplayNamePrice = + fun asMatrixWithDisplayName(): MatrixWithDisplayName = matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asBulkWithProration(): BulkWithProrationPrice = - bulkWithProration.getOrThrow("bulkWithProration") + fun asBulkWithProration(): BulkWithProration = bulkWithProration.getOrThrow("bulkWithProration") - fun asGroupedTieredPackage(): GroupedTieredPackagePrice = + fun asGroupedTieredPackage(): GroupedTieredPackage = groupedTieredPackage.getOrThrow("groupedTieredPackage") - fun asMaxGroupTieredPackage(): MaxGroupTieredPackagePrice = + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricingPrice = + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricingPrice = + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asCumulativeGroupedBulk(): CumulativeGroupedBulkPrice = + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") fun _json(): Optional = Optional.ofNullable(_json) @@ -285,7 +277,7 @@ private constructor( fun accept(visitor: Visitor): T = when { unit != null -> visitor.visitUnit(unit) - packagePrice != null -> visitor.visitPackagePrice(packagePrice) + package_ != null -> visitor.visitPackage(package_) matrix != null -> visitor.visitMatrix(matrix) tiered != null -> visitor.visitTiered(tiered) tieredBps != null -> visitor.visitTieredBps(tieredBps) @@ -333,140 +325,132 @@ private constructor( accept( object : Visitor { - override fun visitUnit(unit: UnitPrice) { + override fun visitUnit(unit: Unit) { unit.validate() } - override fun visitPackagePrice(packagePrice: PackagePrice) { - packagePrice.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitMatrix(matrix: MatrixPrice) { + override fun visitMatrix(matrix: Matrix) { matrix.validate() } - override fun visitTiered(tiered: TieredPrice) { + override fun visitTiered(tiered: Tiered) { tiered.validate() } - override fun visitTieredBps(tieredBps: TieredBpsPrice) { + override fun visitTieredBps(tieredBps: TieredBps) { tieredBps.validate() } - override fun visitBps(bps: BpsPrice) { + override fun visitBps(bps: Bps) { bps.validate() } - override fun visitBulkBps(bulkBps: BulkBpsPrice) { + override fun visitBulkBps(bulkBps: BulkBps) { bulkBps.validate() } - override fun visitBulk(bulk: BulkPrice) { + override fun visitBulk(bulk: Bulk) { bulk.validate() } - override fun visitThresholdTotalAmount( - thresholdTotalAmount: ThresholdTotalAmountPrice - ) { + override fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) { thresholdTotalAmount.validate() } - override fun visitTieredPackage(tieredPackage: TieredPackagePrice) { + override fun visitTieredPackage(tieredPackage: TieredPackage) { tieredPackage.validate() } - override fun visitGroupedTiered(groupedTiered: GroupedTieredPrice) { + override fun visitGroupedTiered(groupedTiered: GroupedTiered) { groupedTiered.validate() } - override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimumPrice) { + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { tieredWithMinimum.validate() } override fun visitTieredPackageWithMinimum( - tieredPackageWithMinimum: TieredPackageWithMinimumPrice + tieredPackageWithMinimum: TieredPackageWithMinimum ) { tieredPackageWithMinimum.validate() } override fun visitPackageWithAllocation( - packageWithAllocation: PackageWithAllocationPrice + packageWithAllocation: PackageWithAllocation ) { packageWithAllocation.validate() } - override fun visitUnitWithPercent(unitWithPercent: UnitWithPercentPrice) { + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { unitWithPercent.validate() } - override fun visitMatrixWithAllocation( - matrixWithAllocation: MatrixWithAllocationPrice - ) { + override fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation) { matrixWithAllocation.validate() } - override fun visitTieredWithProration( - tieredWithProration: TieredWithProrationPrice - ) { + override fun visitTieredWithProration(tieredWithProration: TieredWithProration) { tieredWithProration.validate() } - override fun visitUnitWithProration(unitWithProration: UnitWithProrationPrice) { + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { unitWithProration.validate() } - override fun visitGroupedAllocation(groupedAllocation: GroupedAllocationPrice) { + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { groupedAllocation.validate() } override fun visitGroupedWithProratedMinimum( - groupedWithProratedMinimum: GroupedWithProratedMinimumPrice + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { groupedWithProratedMinimum.validate() } override fun visitGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: GroupedWithMeteredMinimumPrice + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { groupedWithMeteredMinimum.validate() } override fun visitMatrixWithDisplayName( - matrixWithDisplayName: MatrixWithDisplayNamePrice + matrixWithDisplayName: MatrixWithDisplayName ) { matrixWithDisplayName.validate() } - override fun visitBulkWithProration(bulkWithProration: BulkWithProrationPrice) { + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { bulkWithProration.validate() } - override fun visitGroupedTieredPackage( - groupedTieredPackage: GroupedTieredPackagePrice - ) { + override fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) { groupedTieredPackage.validate() } override fun visitMaxGroupTieredPackage( - maxGroupTieredPackage: MaxGroupTieredPackagePrice + maxGroupTieredPackage: MaxGroupTieredPackage ) { maxGroupTieredPackage.validate() } override fun visitScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { scalableMatrixWithUnitPricing.validate() } override fun visitScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { scalableMatrixWithTieredPricing.validate() } override fun visitCumulativeGroupedBulk( - cumulativeGroupedBulk: CumulativeGroupedBulkPrice + cumulativeGroupedBulk: CumulativeGroupedBulk ) { cumulativeGroupedBulk.validate() } @@ -492,93 +476,89 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitUnit(unit: UnitPrice) = unit.validity() + override fun visitUnit(unit: Unit) = unit.validity() - override fun visitPackagePrice(packagePrice: PackagePrice) = packagePrice.validity() + override fun visitPackage(package_: Package) = package_.validity() - override fun visitMatrix(matrix: MatrixPrice) = matrix.validity() + override fun visitMatrix(matrix: Matrix) = matrix.validity() - override fun visitTiered(tiered: TieredPrice) = tiered.validity() + override fun visitTiered(tiered: Tiered) = tiered.validity() - override fun visitTieredBps(tieredBps: TieredBpsPrice) = tieredBps.validity() + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() - override fun visitBps(bps: BpsPrice) = bps.validity() + override fun visitBps(bps: Bps) = bps.validity() - override fun visitBulkBps(bulkBps: BulkBpsPrice) = bulkBps.validity() + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() - override fun visitBulk(bulk: BulkPrice) = bulk.validity() + override fun visitBulk(bulk: Bulk) = bulk.validity() - override fun visitThresholdTotalAmount( - thresholdTotalAmount: ThresholdTotalAmountPrice - ) = thresholdTotalAmount.validity() + override fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + thresholdTotalAmount.validity() - override fun visitTieredPackage(tieredPackage: TieredPackagePrice) = + override fun visitTieredPackage(tieredPackage: TieredPackage) = tieredPackage.validity() - override fun visitGroupedTiered(groupedTiered: GroupedTieredPrice) = + override fun visitGroupedTiered(groupedTiered: GroupedTiered) = groupedTiered.validity() - override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimumPrice) = + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = tieredWithMinimum.validity() override fun visitTieredPackageWithMinimum( - tieredPackageWithMinimum: TieredPackageWithMinimumPrice + tieredPackageWithMinimum: TieredPackageWithMinimum ) = tieredPackageWithMinimum.validity() override fun visitPackageWithAllocation( - packageWithAllocation: PackageWithAllocationPrice + packageWithAllocation: PackageWithAllocation ) = packageWithAllocation.validity() - override fun visitUnitWithPercent(unitWithPercent: UnitWithPercentPrice) = + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = unitWithPercent.validity() - override fun visitMatrixWithAllocation( - matrixWithAllocation: MatrixWithAllocationPrice - ) = matrixWithAllocation.validity() + override fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation) = + matrixWithAllocation.validity() - override fun visitTieredWithProration( - tieredWithProration: TieredWithProrationPrice - ) = tieredWithProration.validity() + override fun visitTieredWithProration(tieredWithProration: TieredWithProration) = + tieredWithProration.validity() - override fun visitUnitWithProration(unitWithProration: UnitWithProrationPrice) = + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = unitWithProration.validity() - override fun visitGroupedAllocation(groupedAllocation: GroupedAllocationPrice) = + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = groupedAllocation.validity() override fun visitGroupedWithProratedMinimum( - groupedWithProratedMinimum: GroupedWithProratedMinimumPrice + groupedWithProratedMinimum: GroupedWithProratedMinimum ) = groupedWithProratedMinimum.validity() override fun visitGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: GroupedWithMeteredMinimumPrice + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) = groupedWithMeteredMinimum.validity() override fun visitMatrixWithDisplayName( - matrixWithDisplayName: MatrixWithDisplayNamePrice + matrixWithDisplayName: MatrixWithDisplayName ) = matrixWithDisplayName.validity() - override fun visitBulkWithProration(bulkWithProration: BulkWithProrationPrice) = + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = bulkWithProration.validity() - override fun visitGroupedTieredPackage( - groupedTieredPackage: GroupedTieredPackagePrice - ) = groupedTieredPackage.validity() + override fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + groupedTieredPackage.validity() override fun visitMaxGroupTieredPackage( - maxGroupTieredPackage: MaxGroupTieredPackagePrice + maxGroupTieredPackage: MaxGroupTieredPackage ) = maxGroupTieredPackage.validity() override fun visitScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = scalableMatrixWithUnitPricing.validity() override fun visitScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = scalableMatrixWithTieredPricing.validity() override fun visitCumulativeGroupedBulk( - cumulativeGroupedBulk: CumulativeGroupedBulkPrice + cumulativeGroupedBulk: CumulativeGroupedBulk ) = cumulativeGroupedBulk.validity() override fun unknown(json: JsonValue?) = 0 @@ -590,15 +570,15 @@ private constructor( return true } - return /* spotless:off */ other is Price && unit == other.unit && packagePrice == other.packagePrice && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && groupedTiered == other.groupedTiered && tieredWithMinimum == other.tieredWithMinimum && tieredPackageWithMinimum == other.tieredPackageWithMinimum && packageWithAllocation == other.packageWithAllocation && unitWithPercent == other.unitWithPercent && matrixWithAllocation == other.matrixWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && maxGroupTieredPackage == other.maxGroupTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && groupedTiered == other.groupedTiered && tieredWithMinimum == other.tieredWithMinimum && tieredPackageWithMinimum == other.tieredPackageWithMinimum && packageWithAllocation == other.packageWithAllocation && unitWithPercent == other.unitWithPercent && matrixWithAllocation == other.matrixWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && maxGroupTieredPackage == other.maxGroupTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, packagePrice, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, groupedTiered, tieredWithMinimum, tieredPackageWithMinimum, packageWithAllocation, unitWithPercent, matrixWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, maxGroupTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, groupedTiered, tieredWithMinimum, tieredPackageWithMinimum, packageWithAllocation, unitWithPercent, matrixWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, maxGroupTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk) /* spotless:on */ override fun toString(): String = when { unit != null -> "Price{unit=$unit}" - packagePrice != null -> "Price{packagePrice=$packagePrice}" + package_ != null -> "Price{package_=$package_}" matrix != null -> "Price{matrix=$matrix}" tiered != null -> "Price{tiered=$tiered}" tieredBps != null -> "Price{tieredBps=$tieredBps}" @@ -636,175 +616,167 @@ private constructor( companion object { - @JvmStatic fun ofUnit(unit: UnitPrice) = Price(unit = unit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofPackagePrice(packagePrice: PackagePrice) = Price(packagePrice = packagePrice) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic fun ofMatrix(matrix: MatrixPrice) = Price(matrix = matrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) - @JvmStatic fun ofTiered(tiered: TieredPrice) = Price(tiered = tiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic fun ofTieredBps(tieredBps: TieredBpsPrice) = Price(tieredBps = tieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic fun ofBps(bps: BpsPrice) = Price(bps = bps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic fun ofBulkBps(bulkBps: BulkBpsPrice) = Price(bulkBps = bulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic fun ofBulk(bulk: BulkPrice) = Price(bulk = bulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmountPrice) = + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofTieredPackage(tieredPackage: TieredPackagePrice) = - Price(tieredPackage = tieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = Price(tieredPackage = tieredPackage) @JvmStatic - fun ofGroupedTiered(groupedTiered: GroupedTieredPrice) = - Price(groupedTiered = groupedTiered) + fun ofGroupedTiered(groupedTiered: GroupedTiered) = Price(groupedTiered = groupedTiered) @JvmStatic - fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimumPrice) = + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimumPrice) = + fun ofTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimum) = Price(tieredPackageWithMinimum = tieredPackageWithMinimum) @JvmStatic - fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocationPrice) = + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofUnitWithPercent(unitWithPercent: UnitWithPercentPrice) = + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocationPrice) = + fun ofMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation) = Price(matrixWithAllocation = matrixWithAllocation) @JvmStatic - fun ofTieredWithProration(tieredWithProration: TieredWithProrationPrice) = + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofUnitWithProration(unitWithProration: UnitWithProrationPrice) = + fun ofUnitWithProration(unitWithProration: UnitWithProration) = Price(unitWithProration = unitWithProration) @JvmStatic - fun ofGroupedAllocation(groupedAllocation: GroupedAllocationPrice) = + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofGroupedWithProratedMinimum( - groupedWithProratedMinimum: GroupedWithProratedMinimumPrice - ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) + fun ofGroupedWithProratedMinimum(groupedWithProratedMinimum: GroupedWithProratedMinimum) = + Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum: GroupedWithMeteredMinimumPrice) = + fun ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayNamePrice) = + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofBulkWithProration(bulkWithProration: BulkWithProrationPrice) = + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackagePrice) = + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = Price(groupedTieredPackage = groupedTieredPackage) @JvmStatic - fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackagePrice) = + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic fun ofScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic fun ofScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulkPrice) = + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = Price(cumulativeGroupedBulk = cumulativeGroupedBulk) } /** An interface that defines how to map each variant of [Price] to a value of type [T]. */ interface Visitor { - fun visitUnit(unit: UnitPrice): T + fun visitUnit(unit: Unit): T - fun visitPackagePrice(packagePrice: PackagePrice): T + fun visitPackage(package_: Package): T - fun visitMatrix(matrix: MatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitTiered(tiered: TieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitTieredBps(tieredBps: TieredBpsPrice): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitBps(bps: BpsPrice): T + fun visitBps(bps: Bps): T - fun visitBulkBps(bulkBps: BulkBpsPrice): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitBulk(bulk: BulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmountPrice): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitTieredPackage(tieredPackage: TieredPackagePrice): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitGroupedTiered(groupedTiered: GroupedTieredPrice): T + fun visitGroupedTiered(groupedTiered: GroupedTiered): T - fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimumPrice): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitTieredPackageWithMinimum( - tieredPackageWithMinimum: TieredPackageWithMinimumPrice - ): T + fun visitTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimum): T - fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocationPrice): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitUnitWithPercent(unitWithPercent: UnitWithPercentPrice): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocationPrice): T + fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation): T - fun visitTieredWithProration(tieredWithProration: TieredWithProrationPrice): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitUnitWithProration(unitWithProration: UnitWithProrationPrice): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitGroupedAllocation(groupedAllocation: GroupedAllocationPrice): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T fun visitGroupedWithProratedMinimum( - groupedWithProratedMinimum: GroupedWithProratedMinimumPrice + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: GroupedWithMeteredMinimumPrice - ): T + fun visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum: GroupedWithMeteredMinimum): T - fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayNamePrice): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitBulkWithProration(bulkWithProration: BulkWithProrationPrice): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackagePrice): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T - fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackagePrice): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T fun visitScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T fun visitScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulkPrice): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -828,148 +800,142 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(unit = it, _json = json) } ?: Price(_json = json) } "package" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(packagePrice = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(matrix = it, _json = json) } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(tiered = it, _json = json) } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(tieredBps = it, _json = json) } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(bps = it, _json = json) } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(bulkBps = it, _json = json) } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(bulk = it, _json = json) } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(thresholdTotalAmount = it, _json = json) } ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(tieredPackage = it, _json = json) } ?: Price(_json = json) } "grouped_tiered" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(groupedTiered = it, _json = json) } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(tieredWithMinimum = it, _json = json) } ?: Price(_json = json) } "tiered_package_with_minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(tieredPackageWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackageWithMinimum = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(packageWithAllocation = it, _json = json) } ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(unitWithPercent = it, _json = json) } ?: Price(_json = json) } "matrix_with_allocation" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(matrixWithAllocation = it, _json = json) } ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(tieredWithProration = it, _json = json) } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(unitWithProration = it, _json = json) } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(groupedAllocation = it, _json = json) } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(groupedWithProratedMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedWithProratedMinimum = it, _json = json) + } ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedWithMeteredMinimum = it, _json = json) + } ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(matrixWithDisplayName = it, _json = json) } ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(bulkWithProration = it, _json = json) } ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(groupedTieredPackage = it, _json = json) } ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(maxGroupTieredPackage = it, _json = json) } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) + return tryDeserialize(node, jacksonTypeRef()) ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) + return tryDeserialize(node, jacksonTypeRef()) ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { Price(cumulativeGroupedBulk = it, _json = json) } ?: Price(_json = json) } @@ -988,7 +954,7 @@ private constructor( ) { when { value.unit != null -> generator.writeObject(value.unit) - value.packagePrice != null -> generator.writeObject(value.packagePrice) + value.package_ != null -> generator.writeObject(value.package_) value.matrix != null -> generator.writeObject(value.matrix) value.tiered != null -> generator.writeObject(value.tiered) value.tieredBps != null -> generator.writeObject(value.tieredBps) @@ -1034,7 +1000,7 @@ private constructor( } } - class UnitPrice + class Unit private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -1529,7 +1495,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [UnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -1560,7 +1526,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1591,32 +1557,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitPrice: UnitPrice) = apply { - id = unitPrice.id - billableMetric = unitPrice.billableMetric - billingCycleConfiguration = unitPrice.billingCycleConfiguration - cadence = unitPrice.cadence - conversionRate = unitPrice.conversionRate - createdAt = unitPrice.createdAt - creditAllocation = unitPrice.creditAllocation - currency = unitPrice.currency - discount = unitPrice.discount - 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 - dimensionalPriceConfiguration = unitPrice.dimensionalPriceConfiguration - additionalProperties = unitPrice.additionalProperties.toMutableMap() + internal fun from(unit: Unit) = apply { + id = unit.id + billableMetric = unit.billableMetric + billingCycleConfiguration = unit.billingCycleConfiguration + cadence = unit.cadence + conversionRate = unit.conversionRate + createdAt = unit.createdAt + creditAllocation = unit.creditAllocation + currency = unit.currency + discount = unit.discount + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + item = unit.item + maximum = unit.maximum + maximumAmount = unit.maximumAmount + metadata = unit.metadata + minimum = unit.minimum + minimumAmount = unit.minimumAmount + modelType = unit.modelType + name = unit.name + planPhaseOrder = unit.planPhaseOrder + priceType = unit.priceType + unitConfig = unit.unitConfig + dimensionalPriceConfiguration = unit.dimensionalPriceConfiguration + additionalProperties = unit.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2064,7 +2030,7 @@ private constructor( } /** - * Returns an immutable instance of [UnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2096,8 +2062,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UnitPrice = - UnitPrice( + fun build(): Unit = + Unit( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -2128,7 +2094,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -4710,7 +4676,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Unit && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4720,10 +4686,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Unit{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class PackagePrice + class Package private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -5219,7 +5185,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [PackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -5250,7 +5216,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -5281,32 +5247,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(packagePrice: PackagePrice) = apply { - id = packagePrice.id - billableMetric = packagePrice.billableMetric - billingCycleConfiguration = packagePrice.billingCycleConfiguration - cadence = packagePrice.cadence - conversionRate = packagePrice.conversionRate - createdAt = packagePrice.createdAt - creditAllocation = packagePrice.creditAllocation - currency = packagePrice.currency - discount = packagePrice.discount - 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 - dimensionalPriceConfiguration = packagePrice.dimensionalPriceConfiguration - additionalProperties = packagePrice.additionalProperties.toMutableMap() + internal fun from(package_: Package) = apply { + id = package_.id + billableMetric = package_.billableMetric + billingCycleConfiguration = package_.billingCycleConfiguration + cadence = package_.cadence + conversionRate = package_.conversionRate + createdAt = package_.createdAt + creditAllocation = package_.creditAllocation + currency = package_.currency + discount = package_.discount + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + item = package_.item + maximum = package_.maximum + maximumAmount = package_.maximumAmount + metadata = package_.metadata + minimum = package_.minimum + minimumAmount = package_.minimumAmount + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + planPhaseOrder = package_.planPhaseOrder + priceType = package_.priceType + dimensionalPriceConfiguration = package_.dimensionalPriceConfiguration + additionalProperties = package_.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -5755,7 +5721,7 @@ private constructor( } /** - * Returns an immutable instance of [PackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5787,8 +5753,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PackagePrice = - PackagePrice( + fun build(): Package = + Package( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -5819,7 +5785,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -8451,7 +8417,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Package && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -8461,10 +8427,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Package{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class MatrixPrice + class Matrix private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -8960,7 +8926,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [MatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -8991,7 +8957,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -9022,32 +8988,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixPrice: MatrixPrice) = apply { - id = matrixPrice.id - billableMetric = matrixPrice.billableMetric - billingCycleConfiguration = matrixPrice.billingCycleConfiguration - cadence = matrixPrice.cadence - conversionRate = matrixPrice.conversionRate - createdAt = matrixPrice.createdAt - creditAllocation = matrixPrice.creditAllocation - currency = matrixPrice.currency - discount = matrixPrice.discount - externalPriceId = matrixPrice.externalPriceId - fixedPriceQuantity = matrixPrice.fixedPriceQuantity - invoicingCycleConfiguration = matrixPrice.invoicingCycleConfiguration - item = matrixPrice.item - matrixConfig = matrixPrice.matrixConfig - maximum = matrixPrice.maximum - maximumAmount = matrixPrice.maximumAmount - metadata = matrixPrice.metadata - minimum = matrixPrice.minimum - minimumAmount = matrixPrice.minimumAmount - modelType = matrixPrice.modelType - name = matrixPrice.name - planPhaseOrder = matrixPrice.planPhaseOrder - priceType = matrixPrice.priceType - dimensionalPriceConfiguration = matrixPrice.dimensionalPriceConfiguration - additionalProperties = matrixPrice.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + id = matrix.id + billableMetric = matrix.billableMetric + billingCycleConfiguration = matrix.billingCycleConfiguration + cadence = matrix.cadence + conversionRate = matrix.conversionRate + createdAt = matrix.createdAt + creditAllocation = matrix.creditAllocation + currency = matrix.currency + discount = matrix.discount + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + item = matrix.item + matrixConfig = matrix.matrixConfig + maximum = matrix.maximum + maximumAmount = matrix.maximumAmount + metadata = matrix.metadata + minimum = matrix.minimum + minimumAmount = matrix.minimumAmount + modelType = matrix.modelType + name = matrix.name + planPhaseOrder = matrix.planPhaseOrder + priceType = matrix.priceType + dimensionalPriceConfiguration = matrix.dimensionalPriceConfiguration + additionalProperties = matrix.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -9495,7 +9461,7 @@ private constructor( } /** - * Returns an immutable instance of [MatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9527,8 +9493,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MatrixPrice = - MatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -9559,7 +9525,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -12497,7 +12463,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Matrix && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -12507,10 +12473,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Matrix{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class TieredPrice + class Tiered private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -13006,7 +12972,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -13037,7 +13003,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -13068,32 +13034,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPrice: TieredPrice) = apply { - id = tieredPrice.id - billableMetric = tieredPrice.billableMetric - billingCycleConfiguration = tieredPrice.billingCycleConfiguration - cadence = tieredPrice.cadence - conversionRate = tieredPrice.conversionRate - createdAt = tieredPrice.createdAt - creditAllocation = tieredPrice.creditAllocation - currency = tieredPrice.currency - discount = tieredPrice.discount - 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 - dimensionalPriceConfiguration = tieredPrice.dimensionalPriceConfiguration - additionalProperties = tieredPrice.additionalProperties.toMutableMap() + internal fun from(tiered: Tiered) = apply { + id = tiered.id + billableMetric = tiered.billableMetric + billingCycleConfiguration = tiered.billingCycleConfiguration + cadence = tiered.cadence + conversionRate = tiered.conversionRate + createdAt = tiered.createdAt + creditAllocation = tiered.creditAllocation + currency = tiered.currency + discount = tiered.discount + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + item = tiered.item + maximum = tiered.maximum + maximumAmount = tiered.maximumAmount + metadata = tiered.metadata + minimum = tiered.minimum + minimumAmount = tiered.minimumAmount + modelType = tiered.modelType + name = tiered.name + planPhaseOrder = tiered.planPhaseOrder + priceType = tiered.priceType + tieredConfig = tiered.tieredConfig + dimensionalPriceConfiguration = tiered.dimensionalPriceConfiguration + additionalProperties = tiered.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -13541,7 +13507,7 @@ private constructor( } /** - * Returns an immutable instance of [TieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -13573,8 +13539,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TieredPrice = - TieredPrice( + fun build(): Tiered = + Tiered( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -13605,7 +13571,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -16461,7 +16427,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tiered && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -16471,10 +16437,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Tiered{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class TieredBpsPrice + class TieredBps private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -16970,7 +16936,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -17001,7 +16967,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -17032,32 +16998,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredBpsPrice: TieredBpsPrice) = apply { - id = tieredBpsPrice.id - billableMetric = tieredBpsPrice.billableMetric - billingCycleConfiguration = tieredBpsPrice.billingCycleConfiguration - cadence = tieredBpsPrice.cadence - conversionRate = tieredBpsPrice.conversionRate - createdAt = tieredBpsPrice.createdAt - creditAllocation = tieredBpsPrice.creditAllocation - currency = tieredBpsPrice.currency - discount = tieredBpsPrice.discount - 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 - dimensionalPriceConfiguration = tieredBpsPrice.dimensionalPriceConfiguration - additionalProperties = tieredBpsPrice.additionalProperties.toMutableMap() + internal fun from(tieredBps: TieredBps) = apply { + id = tieredBps.id + billableMetric = tieredBps.billableMetric + billingCycleConfiguration = tieredBps.billingCycleConfiguration + cadence = tieredBps.cadence + conversionRate = tieredBps.conversionRate + createdAt = tieredBps.createdAt + creditAllocation = tieredBps.creditAllocation + currency = tieredBps.currency + discount = tieredBps.discount + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + item = tieredBps.item + maximum = tieredBps.maximum + maximumAmount = tieredBps.maximumAmount + metadata = tieredBps.metadata + minimum = tieredBps.minimum + minimumAmount = tieredBps.minimumAmount + modelType = tieredBps.modelType + name = tieredBps.name + planPhaseOrder = tieredBps.planPhaseOrder + priceType = tieredBps.priceType + tieredBpsConfig = tieredBps.tieredBpsConfig + dimensionalPriceConfiguration = tieredBps.dimensionalPriceConfiguration + additionalProperties = tieredBps.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -17506,7 +17472,7 @@ private constructor( } /** - * Returns an immutable instance of [TieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -17538,8 +17504,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TieredBpsPrice = - TieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -17570,7 +17536,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -20472,7 +20438,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredBps && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -20482,10 +20448,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredBps{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class BpsPrice + class Bps private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -20980,7 +20946,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [BpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -21011,7 +20977,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -21042,32 +21008,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bpsPrice: BpsPrice) = apply { - id = bpsPrice.id - billableMetric = bpsPrice.billableMetric - billingCycleConfiguration = bpsPrice.billingCycleConfiguration - bpsConfig = bpsPrice.bpsConfig - cadence = bpsPrice.cadence - conversionRate = bpsPrice.conversionRate - createdAt = bpsPrice.createdAt - creditAllocation = bpsPrice.creditAllocation - currency = bpsPrice.currency - discount = bpsPrice.discount - externalPriceId = bpsPrice.externalPriceId - fixedPriceQuantity = bpsPrice.fixedPriceQuantity - invoicingCycleConfiguration = bpsPrice.invoicingCycleConfiguration - item = bpsPrice.item - maximum = bpsPrice.maximum - maximumAmount = bpsPrice.maximumAmount - metadata = bpsPrice.metadata - minimum = bpsPrice.minimum - minimumAmount = bpsPrice.minimumAmount - modelType = bpsPrice.modelType - name = bpsPrice.name - planPhaseOrder = bpsPrice.planPhaseOrder - priceType = bpsPrice.priceType - dimensionalPriceConfiguration = bpsPrice.dimensionalPriceConfiguration - additionalProperties = bpsPrice.additionalProperties.toMutableMap() + internal fun from(bps: Bps) = apply { + id = bps.id + billableMetric = bps.billableMetric + billingCycleConfiguration = bps.billingCycleConfiguration + bpsConfig = bps.bpsConfig + cadence = bps.cadence + conversionRate = bps.conversionRate + createdAt = bps.createdAt + creditAllocation = bps.creditAllocation + currency = bps.currency + discount = bps.discount + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + item = bps.item + maximum = bps.maximum + maximumAmount = bps.maximumAmount + metadata = bps.metadata + minimum = bps.minimum + minimumAmount = bps.minimumAmount + modelType = bps.modelType + name = bps.name + planPhaseOrder = bps.planPhaseOrder + priceType = bps.priceType + dimensionalPriceConfiguration = bps.dimensionalPriceConfiguration + additionalProperties = bps.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -21513,7 +21479,7 @@ private constructor( } /** - * Returns an immutable instance of [BpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -21545,8 +21511,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): BpsPrice = - BpsPrice( + fun build(): Bps = + Bps( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -21577,7 +21543,7 @@ private constructor( private var validated: Boolean = false - fun validate(): BpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -24201,7 +24167,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Bps && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -24211,10 +24177,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Bps{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class BulkBpsPrice + class BulkBps private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -24710,7 +24676,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [BulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -24741,7 +24707,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -24772,32 +24738,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkBpsPrice: BulkBpsPrice) = apply { - id = bulkBpsPrice.id - billableMetric = bulkBpsPrice.billableMetric - billingCycleConfiguration = bulkBpsPrice.billingCycleConfiguration - bulkBpsConfig = bulkBpsPrice.bulkBpsConfig - cadence = bulkBpsPrice.cadence - conversionRate = bulkBpsPrice.conversionRate - createdAt = bulkBpsPrice.createdAt - creditAllocation = bulkBpsPrice.creditAllocation - currency = bulkBpsPrice.currency - discount = bulkBpsPrice.discount - externalPriceId = bulkBpsPrice.externalPriceId - fixedPriceQuantity = bulkBpsPrice.fixedPriceQuantity - invoicingCycleConfiguration = bulkBpsPrice.invoicingCycleConfiguration - item = bulkBpsPrice.item - maximum = bulkBpsPrice.maximum - maximumAmount = bulkBpsPrice.maximumAmount - metadata = bulkBpsPrice.metadata - minimum = bulkBpsPrice.minimum - minimumAmount = bulkBpsPrice.minimumAmount - modelType = bulkBpsPrice.modelType - name = bulkBpsPrice.name - planPhaseOrder = bulkBpsPrice.planPhaseOrder - priceType = bulkBpsPrice.priceType - dimensionalPriceConfiguration = bulkBpsPrice.dimensionalPriceConfiguration - additionalProperties = bulkBpsPrice.additionalProperties.toMutableMap() + internal fun from(bulkBps: BulkBps) = apply { + id = bulkBps.id + billableMetric = bulkBps.billableMetric + billingCycleConfiguration = bulkBps.billingCycleConfiguration + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + conversionRate = bulkBps.conversionRate + createdAt = bulkBps.createdAt + creditAllocation = bulkBps.creditAllocation + currency = bulkBps.currency + discount = bulkBps.discount + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + item = bulkBps.item + maximum = bulkBps.maximum + maximumAmount = bulkBps.maximumAmount + metadata = bulkBps.metadata + minimum = bulkBps.minimum + minimumAmount = bulkBps.minimumAmount + modelType = bulkBps.modelType + name = bulkBps.name + planPhaseOrder = bulkBps.planPhaseOrder + priceType = bulkBps.priceType + dimensionalPriceConfiguration = bulkBps.dimensionalPriceConfiguration + additionalProperties = bulkBps.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -25246,7 +25212,7 @@ private constructor( } /** - * Returns an immutable instance of [BulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -25278,8 +25244,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): BulkBpsPrice = - BulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -25310,7 +25276,7 @@ private constructor( private var validated: Boolean = false - fun validate(): BulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -28168,7 +28134,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkBps && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -28178,10 +28144,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "BulkBps{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class BulkPrice + class Bulk private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -28676,7 +28642,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [BulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -28707,7 +28673,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -28738,32 +28704,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkPrice: BulkPrice) = apply { - id = bulkPrice.id - billableMetric = bulkPrice.billableMetric - billingCycleConfiguration = bulkPrice.billingCycleConfiguration - bulkConfig = bulkPrice.bulkConfig - cadence = bulkPrice.cadence - conversionRate = bulkPrice.conversionRate - createdAt = bulkPrice.createdAt - creditAllocation = bulkPrice.creditAllocation - currency = bulkPrice.currency - discount = bulkPrice.discount - externalPriceId = bulkPrice.externalPriceId - fixedPriceQuantity = bulkPrice.fixedPriceQuantity - invoicingCycleConfiguration = bulkPrice.invoicingCycleConfiguration - item = bulkPrice.item - maximum = bulkPrice.maximum - maximumAmount = bulkPrice.maximumAmount - metadata = bulkPrice.metadata - minimum = bulkPrice.minimum - minimumAmount = bulkPrice.minimumAmount - modelType = bulkPrice.modelType - name = bulkPrice.name - planPhaseOrder = bulkPrice.planPhaseOrder - priceType = bulkPrice.priceType - dimensionalPriceConfiguration = bulkPrice.dimensionalPriceConfiguration - additionalProperties = bulkPrice.additionalProperties.toMutableMap() + internal fun from(bulk: Bulk) = apply { + id = bulk.id + billableMetric = bulk.billableMetric + billingCycleConfiguration = bulk.billingCycleConfiguration + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + conversionRate = bulk.conversionRate + createdAt = bulk.createdAt + creditAllocation = bulk.creditAllocation + currency = bulk.currency + discount = bulk.discount + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + item = bulk.item + maximum = bulk.maximum + maximumAmount = bulk.maximumAmount + metadata = bulk.metadata + minimum = bulk.minimum + minimumAmount = bulk.minimumAmount + modelType = bulk.modelType + name = bulk.name + planPhaseOrder = bulk.planPhaseOrder + priceType = bulk.priceType + dimensionalPriceConfiguration = bulk.dimensionalPriceConfiguration + additionalProperties = bulk.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -29211,7 +29177,7 @@ private constructor( } /** - * Returns an immutable instance of [BulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -29243,8 +29209,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): BulkPrice = - BulkPrice( + fun build(): Bulk = + Bulk( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -29275,7 +29241,7 @@ private constructor( private var validated: Boolean = false - fun validate(): BulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -32093,7 +32059,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Bulk && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -32103,10 +32069,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Bulk{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class ThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -32604,8 +32570,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [ThresholdTotalAmountPrice]. + * Returns a mutable builder for constructing an instance of [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -32636,7 +32601,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -32667,33 +32632,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(thresholdTotalAmountPrice: ThresholdTotalAmountPrice) = apply { - id = thresholdTotalAmountPrice.id - billableMetric = thresholdTotalAmountPrice.billableMetric - billingCycleConfiguration = thresholdTotalAmountPrice.billingCycleConfiguration - cadence = thresholdTotalAmountPrice.cadence - conversionRate = thresholdTotalAmountPrice.conversionRate - createdAt = thresholdTotalAmountPrice.createdAt - creditAllocation = thresholdTotalAmountPrice.creditAllocation - currency = thresholdTotalAmountPrice.currency - discount = thresholdTotalAmountPrice.discount - 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 - dimensionalPriceConfiguration = - thresholdTotalAmountPrice.dimensionalPriceConfiguration - additionalProperties = thresholdTotalAmountPrice.additionalProperties.toMutableMap() + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + id = thresholdTotalAmount.id + billableMetric = thresholdTotalAmount.billableMetric + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + cadence = thresholdTotalAmount.cadence + conversionRate = thresholdTotalAmount.conversionRate + createdAt = thresholdTotalAmount.createdAt + creditAllocation = thresholdTotalAmount.creditAllocation + currency = thresholdTotalAmount.currency + discount = thresholdTotalAmount.discount + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoicingCycleConfiguration = thresholdTotalAmount.invoicingCycleConfiguration + item = thresholdTotalAmount.item + maximum = thresholdTotalAmount.maximum + maximumAmount = thresholdTotalAmount.maximumAmount + metadata = thresholdTotalAmount.metadata + minimum = thresholdTotalAmount.minimum + minimumAmount = thresholdTotalAmount.minimumAmount + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + planPhaseOrder = thresholdTotalAmount.planPhaseOrder + priceType = thresholdTotalAmount.priceType + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + dimensionalPriceConfiguration = thresholdTotalAmount.dimensionalPriceConfiguration + additionalProperties = thresholdTotalAmount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -33142,7 +33106,7 @@ private constructor( } /** - * Returns an immutable instance of [ThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -33174,8 +33138,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ThresholdTotalAmountPrice = - ThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -33206,7 +33170,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -35728,7 +35692,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -35738,10 +35702,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "ThresholdTotalAmount{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class TieredPackagePrice + class TieredPackage private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -36238,7 +36202,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -36269,7 +36233,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -36300,32 +36264,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackagePrice: TieredPackagePrice) = apply { - id = tieredPackagePrice.id - billableMetric = tieredPackagePrice.billableMetric - billingCycleConfiguration = tieredPackagePrice.billingCycleConfiguration - cadence = tieredPackagePrice.cadence - conversionRate = tieredPackagePrice.conversionRate - createdAt = tieredPackagePrice.createdAt - creditAllocation = tieredPackagePrice.creditAllocation - currency = tieredPackagePrice.currency - discount = tieredPackagePrice.discount - 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 - dimensionalPriceConfiguration = tieredPackagePrice.dimensionalPriceConfiguration - additionalProperties = tieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(tieredPackage: TieredPackage) = apply { + id = tieredPackage.id + billableMetric = tieredPackage.billableMetric + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + cadence = tieredPackage.cadence + conversionRate = tieredPackage.conversionRate + createdAt = tieredPackage.createdAt + creditAllocation = tieredPackage.creditAllocation + currency = tieredPackage.currency + discount = tieredPackage.discount + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + item = tieredPackage.item + maximum = tieredPackage.maximum + maximumAmount = tieredPackage.maximumAmount + metadata = tieredPackage.metadata + minimum = tieredPackage.minimum + minimumAmount = tieredPackage.minimumAmount + modelType = tieredPackage.modelType + name = tieredPackage.name + planPhaseOrder = tieredPackage.planPhaseOrder + priceType = tieredPackage.priceType + tieredPackageConfig = tieredPackage.tieredPackageConfig + dimensionalPriceConfiguration = tieredPackage.dimensionalPriceConfiguration + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -36774,7 +36738,7 @@ private constructor( } /** - * Returns an immutable instance of [TieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -36806,8 +36770,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TieredPackagePrice = - TieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -36838,7 +36802,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -39358,7 +39322,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackage && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -39368,10 +39332,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredPackage{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class GroupedTieredPrice + class GroupedTiered private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -39868,7 +39832,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [GroupedTieredPrice]. + * Returns a mutable builder for constructing an instance of [GroupedTiered]. * * The following fields are required: * ```java @@ -39899,7 +39863,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [GroupedTieredPrice]. */ + /** A builder for [GroupedTiered]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -39930,32 +39894,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedTieredPrice: GroupedTieredPrice) = apply { - id = groupedTieredPrice.id - billableMetric = groupedTieredPrice.billableMetric - billingCycleConfiguration = groupedTieredPrice.billingCycleConfiguration - cadence = groupedTieredPrice.cadence - conversionRate = groupedTieredPrice.conversionRate - createdAt = groupedTieredPrice.createdAt - creditAllocation = groupedTieredPrice.creditAllocation - currency = groupedTieredPrice.currency - discount = groupedTieredPrice.discount - externalPriceId = groupedTieredPrice.externalPriceId - fixedPriceQuantity = groupedTieredPrice.fixedPriceQuantity - groupedTieredConfig = groupedTieredPrice.groupedTieredConfig - invoicingCycleConfiguration = groupedTieredPrice.invoicingCycleConfiguration - item = groupedTieredPrice.item - maximum = groupedTieredPrice.maximum - maximumAmount = groupedTieredPrice.maximumAmount - metadata = groupedTieredPrice.metadata - minimum = groupedTieredPrice.minimum - minimumAmount = groupedTieredPrice.minimumAmount - modelType = groupedTieredPrice.modelType - name = groupedTieredPrice.name - planPhaseOrder = groupedTieredPrice.planPhaseOrder - priceType = groupedTieredPrice.priceType - dimensionalPriceConfiguration = groupedTieredPrice.dimensionalPriceConfiguration - additionalProperties = groupedTieredPrice.additionalProperties.toMutableMap() + internal fun from(groupedTiered: GroupedTiered) = apply { + id = groupedTiered.id + billableMetric = groupedTiered.billableMetric + billingCycleConfiguration = groupedTiered.billingCycleConfiguration + cadence = groupedTiered.cadence + conversionRate = groupedTiered.conversionRate + createdAt = groupedTiered.createdAt + creditAllocation = groupedTiered.creditAllocation + currency = groupedTiered.currency + discount = groupedTiered.discount + externalPriceId = groupedTiered.externalPriceId + fixedPriceQuantity = groupedTiered.fixedPriceQuantity + groupedTieredConfig = groupedTiered.groupedTieredConfig + invoicingCycleConfiguration = groupedTiered.invoicingCycleConfiguration + item = groupedTiered.item + maximum = groupedTiered.maximum + maximumAmount = groupedTiered.maximumAmount + metadata = groupedTiered.metadata + minimum = groupedTiered.minimum + minimumAmount = groupedTiered.minimumAmount + modelType = groupedTiered.modelType + name = groupedTiered.name + planPhaseOrder = groupedTiered.planPhaseOrder + priceType = groupedTiered.priceType + dimensionalPriceConfiguration = groupedTiered.dimensionalPriceConfiguration + additionalProperties = groupedTiered.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -40404,7 +40368,7 @@ private constructor( } /** - * Returns an immutable instance of [GroupedTieredPrice]. + * Returns an immutable instance of [GroupedTiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -40436,8 +40400,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): GroupedTieredPrice = - GroupedTieredPrice( + fun build(): GroupedTiered = + GroupedTiered( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -40468,7 +40432,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedTieredPrice = apply { + fun validate(): GroupedTiered = apply { if (validated) { return@apply } @@ -42988,7 +42952,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTiered && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -42998,10 +42962,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedTiered{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class TieredWithMinimumPrice + class TieredWithMinimum private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -43498,7 +43462,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TieredWithMinimumPrice]. + * Returns a mutable builder for constructing an instance of [TieredWithMinimum]. * * The following fields are required: * ```java @@ -43529,7 +43493,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -43560,32 +43524,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithMinimumPrice: TieredWithMinimumPrice) = apply { - id = tieredWithMinimumPrice.id - billableMetric = tieredWithMinimumPrice.billableMetric - billingCycleConfiguration = tieredWithMinimumPrice.billingCycleConfiguration - cadence = tieredWithMinimumPrice.cadence - conversionRate = tieredWithMinimumPrice.conversionRate - createdAt = tieredWithMinimumPrice.createdAt - creditAllocation = tieredWithMinimumPrice.creditAllocation - currency = tieredWithMinimumPrice.currency - discount = tieredWithMinimumPrice.discount - 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 - dimensionalPriceConfiguration = tieredWithMinimumPrice.dimensionalPriceConfiguration - additionalProperties = tieredWithMinimumPrice.additionalProperties.toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + id = tieredWithMinimum.id + billableMetric = tieredWithMinimum.billableMetric + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + cadence = tieredWithMinimum.cadence + conversionRate = tieredWithMinimum.conversionRate + createdAt = tieredWithMinimum.createdAt + creditAllocation = tieredWithMinimum.creditAllocation + currency = tieredWithMinimum.currency + discount = tieredWithMinimum.discount + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + item = tieredWithMinimum.item + maximum = tieredWithMinimum.maximum + maximumAmount = tieredWithMinimum.maximumAmount + metadata = tieredWithMinimum.metadata + minimum = tieredWithMinimum.minimum + minimumAmount = tieredWithMinimum.minimumAmount + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + planPhaseOrder = tieredWithMinimum.planPhaseOrder + priceType = tieredWithMinimum.priceType + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + dimensionalPriceConfiguration = tieredWithMinimum.dimensionalPriceConfiguration + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -44034,7 +43998,7 @@ private constructor( } /** - * Returns an immutable instance of [TieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -44066,8 +44030,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TieredWithMinimumPrice = - TieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -44098,7 +44062,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -46620,7 +46584,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithMinimum && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -46630,10 +46594,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredWithMinimum{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class TieredPackageWithMinimumPrice + class TieredPackageWithMinimum private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -47132,8 +47096,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [TieredPackageWithMinimumPrice]. + * Returns a mutable builder for constructing an instance of [TieredPackageWithMinimum]. * * The following fields are required: * ```java @@ -47164,7 +47127,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredPackageWithMinimumPrice]. */ + /** A builder for [TieredPackageWithMinimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -47196,39 +47159,35 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackageWithMinimumPrice: TieredPackageWithMinimumPrice) = - apply { - id = tieredPackageWithMinimumPrice.id - billableMetric = tieredPackageWithMinimumPrice.billableMetric - billingCycleConfiguration = - tieredPackageWithMinimumPrice.billingCycleConfiguration - cadence = tieredPackageWithMinimumPrice.cadence - conversionRate = tieredPackageWithMinimumPrice.conversionRate - createdAt = tieredPackageWithMinimumPrice.createdAt - creditAllocation = tieredPackageWithMinimumPrice.creditAllocation - currency = tieredPackageWithMinimumPrice.currency - discount = tieredPackageWithMinimumPrice.discount - 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 - dimensionalPriceConfiguration = - tieredPackageWithMinimumPrice.dimensionalPriceConfiguration - additionalProperties = - tieredPackageWithMinimumPrice.additionalProperties.toMutableMap() - } + internal fun from(tieredPackageWithMinimum: TieredPackageWithMinimum) = apply { + id = tieredPackageWithMinimum.id + billableMetric = tieredPackageWithMinimum.billableMetric + billingCycleConfiguration = tieredPackageWithMinimum.billingCycleConfiguration + cadence = tieredPackageWithMinimum.cadence + conversionRate = tieredPackageWithMinimum.conversionRate + createdAt = tieredPackageWithMinimum.createdAt + creditAllocation = tieredPackageWithMinimum.creditAllocation + currency = tieredPackageWithMinimum.currency + discount = tieredPackageWithMinimum.discount + externalPriceId = tieredPackageWithMinimum.externalPriceId + fixedPriceQuantity = tieredPackageWithMinimum.fixedPriceQuantity + invoicingCycleConfiguration = tieredPackageWithMinimum.invoicingCycleConfiguration + item = tieredPackageWithMinimum.item + maximum = tieredPackageWithMinimum.maximum + maximumAmount = tieredPackageWithMinimum.maximumAmount + metadata = tieredPackageWithMinimum.metadata + minimum = tieredPackageWithMinimum.minimum + minimumAmount = tieredPackageWithMinimum.minimumAmount + modelType = tieredPackageWithMinimum.modelType + name = tieredPackageWithMinimum.name + planPhaseOrder = tieredPackageWithMinimum.planPhaseOrder + priceType = tieredPackageWithMinimum.priceType + tieredPackageWithMinimumConfig = + tieredPackageWithMinimum.tieredPackageWithMinimumConfig + dimensionalPriceConfiguration = + tieredPackageWithMinimum.dimensionalPriceConfiguration + additionalProperties = tieredPackageWithMinimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -47677,7 +47636,7 @@ private constructor( } /** - * Returns an immutable instance of [TieredPackageWithMinimumPrice]. + * Returns an immutable instance of [TieredPackageWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -47709,8 +47668,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TieredPackageWithMinimumPrice = - TieredPackageWithMinimumPrice( + fun build(): TieredPackageWithMinimum = + TieredPackageWithMinimum( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -47741,7 +47700,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredPackageWithMinimumPrice = apply { + fun validate(): TieredPackageWithMinimum = apply { if (validated) { return@apply } @@ -50266,7 +50225,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackageWithMinimum && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -50276,10 +50235,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredPackageWithMinimum{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class PackageWithAllocationPrice + class PackageWithAllocation private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -50777,8 +50736,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PackageWithAllocationPrice]. + * Returns a mutable builder for constructing an instance of [PackageWithAllocation]. * * The following fields are required: * ```java @@ -50809,7 +50767,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -50840,34 +50798,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(packageWithAllocationPrice: PackageWithAllocationPrice) = apply { - id = packageWithAllocationPrice.id - billableMetric = packageWithAllocationPrice.billableMetric - billingCycleConfiguration = packageWithAllocationPrice.billingCycleConfiguration - cadence = packageWithAllocationPrice.cadence - conversionRate = packageWithAllocationPrice.conversionRate - createdAt = packageWithAllocationPrice.createdAt - creditAllocation = packageWithAllocationPrice.creditAllocation - currency = packageWithAllocationPrice.currency - discount = packageWithAllocationPrice.discount - 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 - dimensionalPriceConfiguration = - packageWithAllocationPrice.dimensionalPriceConfiguration - additionalProperties = - packageWithAllocationPrice.additionalProperties.toMutableMap() + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + id = packageWithAllocation.id + billableMetric = packageWithAllocation.billableMetric + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + cadence = packageWithAllocation.cadence + conversionRate = packageWithAllocation.conversionRate + createdAt = packageWithAllocation.createdAt + creditAllocation = packageWithAllocation.creditAllocation + currency = packageWithAllocation.currency + discount = packageWithAllocation.discount + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoicingCycleConfiguration = packageWithAllocation.invoicingCycleConfiguration + item = packageWithAllocation.item + maximum = packageWithAllocation.maximum + maximumAmount = packageWithAllocation.maximumAmount + metadata = packageWithAllocation.metadata + minimum = packageWithAllocation.minimum + minimumAmount = packageWithAllocation.minimumAmount + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name + packageWithAllocationConfig = packageWithAllocation.packageWithAllocationConfig + planPhaseOrder = packageWithAllocation.planPhaseOrder + priceType = packageWithAllocation.priceType + dimensionalPriceConfiguration = packageWithAllocation.dimensionalPriceConfiguration + additionalProperties = packageWithAllocation.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -51317,7 +51273,7 @@ private constructor( } /** - * Returns an immutable instance of [PackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -51349,8 +51305,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PackageWithAllocationPrice = - PackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -51381,7 +51337,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -53904,7 +53860,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackageWithAllocation && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -53914,10 +53870,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "PackageWithAllocation{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class UnitWithPercentPrice + class UnitWithPercent private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -54414,7 +54370,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [UnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -54445,7 +54401,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -54476,32 +54432,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithPercentPrice: UnitWithPercentPrice) = apply { - id = unitWithPercentPrice.id - billableMetric = unitWithPercentPrice.billableMetric - billingCycleConfiguration = unitWithPercentPrice.billingCycleConfiguration - cadence = unitWithPercentPrice.cadence - conversionRate = unitWithPercentPrice.conversionRate - createdAt = unitWithPercentPrice.createdAt - creditAllocation = unitWithPercentPrice.creditAllocation - currency = unitWithPercentPrice.currency - discount = unitWithPercentPrice.discount - 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 - dimensionalPriceConfiguration = unitWithPercentPrice.dimensionalPriceConfiguration - additionalProperties = unitWithPercentPrice.additionalProperties.toMutableMap() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + id = unitWithPercent.id + billableMetric = unitWithPercent.billableMetric + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + cadence = unitWithPercent.cadence + conversionRate = unitWithPercent.conversionRate + createdAt = unitWithPercent.createdAt + creditAllocation = unitWithPercent.creditAllocation + currency = unitWithPercent.currency + discount = unitWithPercent.discount + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + item = unitWithPercent.item + maximum = unitWithPercent.maximum + maximumAmount = unitWithPercent.maximumAmount + metadata = unitWithPercent.metadata + minimum = unitWithPercent.minimum + minimumAmount = unitWithPercent.minimumAmount + modelType = unitWithPercent.modelType + name = unitWithPercent.name + planPhaseOrder = unitWithPercent.planPhaseOrder + priceType = unitWithPercent.priceType + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + dimensionalPriceConfiguration = unitWithPercent.dimensionalPriceConfiguration + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -54951,7 +54907,7 @@ private constructor( } /** - * Returns an immutable instance of [UnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -54983,8 +54939,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UnitWithPercentPrice = - UnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -55015,7 +54971,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -57536,7 +57492,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithPercent && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -57546,10 +57502,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "UnitWithPercent{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class MatrixWithAllocationPrice + class MatrixWithAllocation private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -58047,8 +58003,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MatrixWithAllocationPrice]. + * Returns a mutable builder for constructing an instance of [MatrixWithAllocation]. * * The following fields are required: * ```java @@ -58079,7 +58034,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixWithAllocationPrice]. */ + /** A builder for [MatrixWithAllocation]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -58110,33 +58065,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixWithAllocationPrice: MatrixWithAllocationPrice) = apply { - id = matrixWithAllocationPrice.id - billableMetric = matrixWithAllocationPrice.billableMetric - billingCycleConfiguration = matrixWithAllocationPrice.billingCycleConfiguration - cadence = matrixWithAllocationPrice.cadence - conversionRate = matrixWithAllocationPrice.conversionRate - createdAt = matrixWithAllocationPrice.createdAt - creditAllocation = matrixWithAllocationPrice.creditAllocation - currency = matrixWithAllocationPrice.currency - discount = matrixWithAllocationPrice.discount - externalPriceId = matrixWithAllocationPrice.externalPriceId - fixedPriceQuantity = matrixWithAllocationPrice.fixedPriceQuantity - invoicingCycleConfiguration = matrixWithAllocationPrice.invoicingCycleConfiguration - item = matrixWithAllocationPrice.item - matrixWithAllocationConfig = matrixWithAllocationPrice.matrixWithAllocationConfig - maximum = matrixWithAllocationPrice.maximum - maximumAmount = matrixWithAllocationPrice.maximumAmount - metadata = matrixWithAllocationPrice.metadata - minimum = matrixWithAllocationPrice.minimum - minimumAmount = matrixWithAllocationPrice.minimumAmount - modelType = matrixWithAllocationPrice.modelType - name = matrixWithAllocationPrice.name - planPhaseOrder = matrixWithAllocationPrice.planPhaseOrder - priceType = matrixWithAllocationPrice.priceType - dimensionalPriceConfiguration = - matrixWithAllocationPrice.dimensionalPriceConfiguration - additionalProperties = matrixWithAllocationPrice.additionalProperties.toMutableMap() + internal fun from(matrixWithAllocation: MatrixWithAllocation) = apply { + id = matrixWithAllocation.id + billableMetric = matrixWithAllocation.billableMetric + billingCycleConfiguration = matrixWithAllocation.billingCycleConfiguration + cadence = matrixWithAllocation.cadence + conversionRate = matrixWithAllocation.conversionRate + createdAt = matrixWithAllocation.createdAt + creditAllocation = matrixWithAllocation.creditAllocation + currency = matrixWithAllocation.currency + discount = matrixWithAllocation.discount + externalPriceId = matrixWithAllocation.externalPriceId + fixedPriceQuantity = matrixWithAllocation.fixedPriceQuantity + invoicingCycleConfiguration = matrixWithAllocation.invoicingCycleConfiguration + item = matrixWithAllocation.item + matrixWithAllocationConfig = matrixWithAllocation.matrixWithAllocationConfig + maximum = matrixWithAllocation.maximum + maximumAmount = matrixWithAllocation.maximumAmount + metadata = matrixWithAllocation.metadata + minimum = matrixWithAllocation.minimum + minimumAmount = matrixWithAllocation.minimumAmount + modelType = matrixWithAllocation.modelType + name = matrixWithAllocation.name + planPhaseOrder = matrixWithAllocation.planPhaseOrder + priceType = matrixWithAllocation.priceType + dimensionalPriceConfiguration = matrixWithAllocation.dimensionalPriceConfiguration + additionalProperties = matrixWithAllocation.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -58585,7 +58539,7 @@ private constructor( } /** - * Returns an immutable instance of [MatrixWithAllocationPrice]. + * Returns an immutable instance of [MatrixWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -58617,8 +58571,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MatrixWithAllocationPrice = - MatrixWithAllocationPrice( + fun build(): MatrixWithAllocation = + MatrixWithAllocation( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -58649,7 +58603,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixWithAllocationPrice = apply { + fun validate(): MatrixWithAllocation = apply { if (validated) { return@apply } @@ -61634,7 +61588,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocation && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -61644,10 +61598,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "MatrixWithAllocation{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class TieredWithProrationPrice + class TieredWithProration private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -62145,7 +62099,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TieredWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [TieredWithProration]. * * The following fields are required: * ```java @@ -62176,7 +62130,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -62207,33 +62161,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithProrationPrice: TieredWithProrationPrice) = apply { - id = tieredWithProrationPrice.id - billableMetric = tieredWithProrationPrice.billableMetric - billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration - cadence = tieredWithProrationPrice.cadence - conversionRate = tieredWithProrationPrice.conversionRate - createdAt = tieredWithProrationPrice.createdAt - creditAllocation = tieredWithProrationPrice.creditAllocation - currency = tieredWithProrationPrice.currency - discount = tieredWithProrationPrice.discount - 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 - dimensionalPriceConfiguration = - tieredWithProrationPrice.dimensionalPriceConfiguration - additionalProperties = tieredWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(tieredWithProration: TieredWithProration) = apply { + id = tieredWithProration.id + billableMetric = tieredWithProration.billableMetric + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + cadence = tieredWithProration.cadence + conversionRate = tieredWithProration.conversionRate + createdAt = tieredWithProration.createdAt + creditAllocation = tieredWithProration.creditAllocation + currency = tieredWithProration.currency + discount = tieredWithProration.discount + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoicingCycleConfiguration = tieredWithProration.invoicingCycleConfiguration + item = tieredWithProration.item + maximum = tieredWithProration.maximum + maximumAmount = tieredWithProration.maximumAmount + metadata = tieredWithProration.metadata + minimum = tieredWithProration.minimum + minimumAmount = tieredWithProration.minimumAmount + modelType = tieredWithProration.modelType + name = tieredWithProration.name + planPhaseOrder = tieredWithProration.planPhaseOrder + priceType = tieredWithProration.priceType + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + dimensionalPriceConfiguration = tieredWithProration.dimensionalPriceConfiguration + additionalProperties = tieredWithProration.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -62682,7 +62635,7 @@ private constructor( } /** - * Returns an immutable instance of [TieredWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -62714,8 +62667,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TieredWithProrationPrice = - TieredWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -62746,7 +62699,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -65268,7 +65221,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithProration && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65278,10 +65231,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredWithProration{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class UnitWithProrationPrice + class UnitWithProration private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -65778,7 +65731,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [UnitWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithProration]. * * The following fields are required: * ```java @@ -65809,7 +65762,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -65840,32 +65793,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithProrationPrice: UnitWithProrationPrice) = apply { - id = unitWithProrationPrice.id - billableMetric = unitWithProrationPrice.billableMetric - billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration - cadence = unitWithProrationPrice.cadence - conversionRate = unitWithProrationPrice.conversionRate - createdAt = unitWithProrationPrice.createdAt - creditAllocation = unitWithProrationPrice.creditAllocation - currency = unitWithProrationPrice.currency - discount = unitWithProrationPrice.discount - 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 - dimensionalPriceConfiguration = unitWithProrationPrice.dimensionalPriceConfiguration - additionalProperties = unitWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + id = unitWithProration.id + billableMetric = unitWithProration.billableMetric + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + cadence = unitWithProration.cadence + conversionRate = unitWithProration.conversionRate + createdAt = unitWithProration.createdAt + creditAllocation = unitWithProration.creditAllocation + currency = unitWithProration.currency + discount = unitWithProration.discount + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + item = unitWithProration.item + maximum = unitWithProration.maximum + maximumAmount = unitWithProration.maximumAmount + metadata = unitWithProration.metadata + minimum = unitWithProration.minimum + minimumAmount = unitWithProration.minimumAmount + modelType = unitWithProration.modelType + name = unitWithProration.name + planPhaseOrder = unitWithProration.planPhaseOrder + priceType = unitWithProration.priceType + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + dimensionalPriceConfiguration = unitWithProration.dimensionalPriceConfiguration + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -66314,7 +66267,7 @@ private constructor( } /** - * Returns an immutable instance of [UnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -66346,8 +66299,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UnitWithProrationPrice = - UnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -66378,7 +66331,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -68900,7 +68853,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProration && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -68910,10 +68863,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "UnitWithProration{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class GroupedAllocationPrice + class GroupedAllocation private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -69410,7 +69363,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [GroupedAllocationPrice]. + * Returns a mutable builder for constructing an instance of [GroupedAllocation]. * * The following fields are required: * ```java @@ -69441,7 +69394,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [GroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -69472,32 +69425,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedAllocationPrice: GroupedAllocationPrice) = apply { - id = groupedAllocationPrice.id - billableMetric = groupedAllocationPrice.billableMetric - billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration - cadence = groupedAllocationPrice.cadence - conversionRate = groupedAllocationPrice.conversionRate - createdAt = groupedAllocationPrice.createdAt - creditAllocation = groupedAllocationPrice.creditAllocation - currency = groupedAllocationPrice.currency - discount = groupedAllocationPrice.discount - externalPriceId = groupedAllocationPrice.externalPriceId - fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity - groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig - invoicingCycleConfiguration = groupedAllocationPrice.invoicingCycleConfiguration - item = groupedAllocationPrice.item - maximum = groupedAllocationPrice.maximum - maximumAmount = groupedAllocationPrice.maximumAmount - metadata = groupedAllocationPrice.metadata - minimum = groupedAllocationPrice.minimum - minimumAmount = groupedAllocationPrice.minimumAmount - modelType = groupedAllocationPrice.modelType - name = groupedAllocationPrice.name - planPhaseOrder = groupedAllocationPrice.planPhaseOrder - priceType = groupedAllocationPrice.priceType - dimensionalPriceConfiguration = groupedAllocationPrice.dimensionalPriceConfiguration - additionalProperties = groupedAllocationPrice.additionalProperties.toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + id = groupedAllocation.id + billableMetric = groupedAllocation.billableMetric + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + cadence = groupedAllocation.cadence + conversionRate = groupedAllocation.conversionRate + createdAt = groupedAllocation.createdAt + creditAllocation = groupedAllocation.creditAllocation + currency = groupedAllocation.currency + discount = groupedAllocation.discount + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + item = groupedAllocation.item + maximum = groupedAllocation.maximum + maximumAmount = groupedAllocation.maximumAmount + metadata = groupedAllocation.metadata + minimum = groupedAllocation.minimum + minimumAmount = groupedAllocation.minimumAmount + modelType = groupedAllocation.modelType + name = groupedAllocation.name + planPhaseOrder = groupedAllocation.planPhaseOrder + priceType = groupedAllocation.priceType + dimensionalPriceConfiguration = groupedAllocation.dimensionalPriceConfiguration + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -69946,7 +69899,7 @@ private constructor( } /** - * Returns an immutable instance of [GroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -69978,8 +69931,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): GroupedAllocationPrice = - GroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -70010,7 +69963,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -72532,7 +72485,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedAllocation && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -72542,10 +72495,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedAllocation{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class GroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -73045,7 +72998,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [GroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -73076,7 +73029,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [GroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -73109,39 +73062,36 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedWithProratedMinimumPrice: GroupedWithProratedMinimumPrice) = - apply { - id = groupedWithProratedMinimumPrice.id - billableMetric = groupedWithProratedMinimumPrice.billableMetric - billingCycleConfiguration = - groupedWithProratedMinimumPrice.billingCycleConfiguration - cadence = groupedWithProratedMinimumPrice.cadence - conversionRate = groupedWithProratedMinimumPrice.conversionRate - createdAt = groupedWithProratedMinimumPrice.createdAt - creditAllocation = groupedWithProratedMinimumPrice.creditAllocation - currency = groupedWithProratedMinimumPrice.currency - discount = groupedWithProratedMinimumPrice.discount - 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 - dimensionalPriceConfiguration = - groupedWithProratedMinimumPrice.dimensionalPriceConfiguration - additionalProperties = - groupedWithProratedMinimumPrice.additionalProperties.toMutableMap() - } + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = apply { + id = groupedWithProratedMinimum.id + billableMetric = groupedWithProratedMinimum.billableMetric + billingCycleConfiguration = groupedWithProratedMinimum.billingCycleConfiguration + cadence = groupedWithProratedMinimum.cadence + conversionRate = groupedWithProratedMinimum.conversionRate + createdAt = groupedWithProratedMinimum.createdAt + creditAllocation = groupedWithProratedMinimum.creditAllocation + currency = groupedWithProratedMinimum.currency + discount = groupedWithProratedMinimum.discount + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + groupedWithProratedMinimumConfig = + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + invoicingCycleConfiguration = groupedWithProratedMinimum.invoicingCycleConfiguration + item = groupedWithProratedMinimum.item + maximum = groupedWithProratedMinimum.maximum + maximumAmount = groupedWithProratedMinimum.maximumAmount + metadata = groupedWithProratedMinimum.metadata + minimum = groupedWithProratedMinimum.minimum + minimumAmount = groupedWithProratedMinimum.minimumAmount + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + planPhaseOrder = groupedWithProratedMinimum.planPhaseOrder + priceType = groupedWithProratedMinimum.priceType + dimensionalPriceConfiguration = + groupedWithProratedMinimum.dimensionalPriceConfiguration + additionalProperties = + groupedWithProratedMinimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -73590,7 +73540,7 @@ private constructor( } /** - * Returns an immutable instance of [GroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -73622,8 +73572,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): GroupedWithProratedMinimumPrice = - GroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -73657,7 +73607,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -76183,7 +76133,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -76193,10 +76143,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimum{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class GroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -76696,7 +76646,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [GroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -76727,7 +76677,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [GroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -76760,39 +76710,35 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice) = - apply { - id = groupedWithMeteredMinimumPrice.id - billableMetric = groupedWithMeteredMinimumPrice.billableMetric - billingCycleConfiguration = - groupedWithMeteredMinimumPrice.billingCycleConfiguration - cadence = groupedWithMeteredMinimumPrice.cadence - conversionRate = groupedWithMeteredMinimumPrice.conversionRate - createdAt = groupedWithMeteredMinimumPrice.createdAt - creditAllocation = groupedWithMeteredMinimumPrice.creditAllocation - currency = groupedWithMeteredMinimumPrice.currency - discount = groupedWithMeteredMinimumPrice.discount - 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 - dimensionalPriceConfiguration = - groupedWithMeteredMinimumPrice.dimensionalPriceConfiguration - additionalProperties = - groupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() - } + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = apply { + id = groupedWithMeteredMinimum.id + billableMetric = groupedWithMeteredMinimum.billableMetric + billingCycleConfiguration = groupedWithMeteredMinimum.billingCycleConfiguration + cadence = groupedWithMeteredMinimum.cadence + conversionRate = groupedWithMeteredMinimum.conversionRate + createdAt = groupedWithMeteredMinimum.createdAt + creditAllocation = groupedWithMeteredMinimum.creditAllocation + currency = groupedWithMeteredMinimum.currency + discount = groupedWithMeteredMinimum.discount + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + invoicingCycleConfiguration = groupedWithMeteredMinimum.invoicingCycleConfiguration + item = groupedWithMeteredMinimum.item + maximum = groupedWithMeteredMinimum.maximum + maximumAmount = groupedWithMeteredMinimum.maximumAmount + metadata = groupedWithMeteredMinimum.metadata + minimum = groupedWithMeteredMinimum.minimum + minimumAmount = groupedWithMeteredMinimum.minimumAmount + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + planPhaseOrder = groupedWithMeteredMinimum.planPhaseOrder + priceType = groupedWithMeteredMinimum.priceType + dimensionalPriceConfiguration = + groupedWithMeteredMinimum.dimensionalPriceConfiguration + additionalProperties = groupedWithMeteredMinimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -77241,7 +77187,7 @@ private constructor( } /** - * Returns an immutable instance of [GroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -77273,8 +77219,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): GroupedWithMeteredMinimumPrice = - GroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -77308,7 +77254,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -79834,7 +79780,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -79844,10 +79790,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimum{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class MatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -80345,8 +80291,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MatrixWithDisplayNamePrice]. + * Returns a mutable builder for constructing an instance of [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -80377,7 +80322,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -80408,34 +80353,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice) = apply { - id = matrixWithDisplayNamePrice.id - billableMetric = matrixWithDisplayNamePrice.billableMetric - billingCycleConfiguration = matrixWithDisplayNamePrice.billingCycleConfiguration - cadence = matrixWithDisplayNamePrice.cadence - conversionRate = matrixWithDisplayNamePrice.conversionRate - createdAt = matrixWithDisplayNamePrice.createdAt - creditAllocation = matrixWithDisplayNamePrice.creditAllocation - currency = matrixWithDisplayNamePrice.currency - discount = matrixWithDisplayNamePrice.discount - externalPriceId = matrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity - invoicingCycleConfiguration = matrixWithDisplayNamePrice.invoicingCycleConfiguration - item = matrixWithDisplayNamePrice.item - matrixWithDisplayNameConfig = matrixWithDisplayNamePrice.matrixWithDisplayNameConfig - maximum = matrixWithDisplayNamePrice.maximum - maximumAmount = matrixWithDisplayNamePrice.maximumAmount - metadata = matrixWithDisplayNamePrice.metadata - minimum = matrixWithDisplayNamePrice.minimum - minimumAmount = matrixWithDisplayNamePrice.minimumAmount - modelType = matrixWithDisplayNamePrice.modelType - name = matrixWithDisplayNamePrice.name - planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder - priceType = matrixWithDisplayNamePrice.priceType - dimensionalPriceConfiguration = - matrixWithDisplayNamePrice.dimensionalPriceConfiguration - additionalProperties = - matrixWithDisplayNamePrice.additionalProperties.toMutableMap() + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + id = matrixWithDisplayName.id + billableMetric = matrixWithDisplayName.billableMetric + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + cadence = matrixWithDisplayName.cadence + conversionRate = matrixWithDisplayName.conversionRate + createdAt = matrixWithDisplayName.createdAt + creditAllocation = matrixWithDisplayName.creditAllocation + currency = matrixWithDisplayName.currency + discount = matrixWithDisplayName.discount + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoicingCycleConfiguration = matrixWithDisplayName.invoicingCycleConfiguration + item = matrixWithDisplayName.item + matrixWithDisplayNameConfig = matrixWithDisplayName.matrixWithDisplayNameConfig + maximum = matrixWithDisplayName.maximum + maximumAmount = matrixWithDisplayName.maximumAmount + metadata = matrixWithDisplayName.metadata + minimum = matrixWithDisplayName.minimum + minimumAmount = matrixWithDisplayName.minimumAmount + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + planPhaseOrder = matrixWithDisplayName.planPhaseOrder + priceType = matrixWithDisplayName.priceType + dimensionalPriceConfiguration = matrixWithDisplayName.dimensionalPriceConfiguration + additionalProperties = matrixWithDisplayName.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -80885,7 +80828,7 @@ private constructor( } /** - * Returns an immutable instance of [MatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -80917,8 +80860,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MatrixWithDisplayNamePrice = - MatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -80949,7 +80892,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -83472,7 +83415,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -83482,10 +83425,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "MatrixWithDisplayName{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class BulkWithProrationPrice + class BulkWithProration private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -83982,7 +83925,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [BulkWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [BulkWithProration]. * * The following fields are required: * ```java @@ -84013,7 +83956,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -84044,32 +83987,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkWithProrationPrice: BulkWithProrationPrice) = apply { - id = bulkWithProrationPrice.id - billableMetric = bulkWithProrationPrice.billableMetric - billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration - bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig - cadence = bulkWithProrationPrice.cadence - conversionRate = bulkWithProrationPrice.conversionRate - createdAt = bulkWithProrationPrice.createdAt - creditAllocation = bulkWithProrationPrice.creditAllocation - currency = bulkWithProrationPrice.currency - discount = bulkWithProrationPrice.discount - externalPriceId = bulkWithProrationPrice.externalPriceId - fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity - invoicingCycleConfiguration = bulkWithProrationPrice.invoicingCycleConfiguration - item = bulkWithProrationPrice.item - maximum = bulkWithProrationPrice.maximum - maximumAmount = bulkWithProrationPrice.maximumAmount - metadata = bulkWithProrationPrice.metadata - minimum = bulkWithProrationPrice.minimum - minimumAmount = bulkWithProrationPrice.minimumAmount - modelType = bulkWithProrationPrice.modelType - name = bulkWithProrationPrice.name - planPhaseOrder = bulkWithProrationPrice.planPhaseOrder - priceType = bulkWithProrationPrice.priceType - dimensionalPriceConfiguration = bulkWithProrationPrice.dimensionalPriceConfiguration - additionalProperties = bulkWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + id = bulkWithProration.id + billableMetric = bulkWithProration.billableMetric + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + conversionRate = bulkWithProration.conversionRate + createdAt = bulkWithProration.createdAt + creditAllocation = bulkWithProration.creditAllocation + currency = bulkWithProration.currency + discount = bulkWithProration.discount + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + item = bulkWithProration.item + maximum = bulkWithProration.maximum + maximumAmount = bulkWithProration.maximumAmount + metadata = bulkWithProration.metadata + minimum = bulkWithProration.minimum + minimumAmount = bulkWithProration.minimumAmount + modelType = bulkWithProration.modelType + name = bulkWithProration.name + planPhaseOrder = bulkWithProration.planPhaseOrder + priceType = bulkWithProration.priceType + dimensionalPriceConfiguration = bulkWithProration.dimensionalPriceConfiguration + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -84518,7 +84461,7 @@ private constructor( } /** - * Returns an immutable instance of [BulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -84550,8 +84493,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): BulkWithProrationPrice = - BulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -84582,7 +84525,7 @@ private constructor( private var validated: Boolean = false - fun validate(): BulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -87104,7 +87047,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkWithProration && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -87114,10 +87057,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "BulkWithProration{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class GroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -87615,8 +87558,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [GroupedTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -87647,7 +87589,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [GroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -87678,33 +87620,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedTieredPackagePrice: GroupedTieredPackagePrice) = apply { - id = groupedTieredPackagePrice.id - billableMetric = groupedTieredPackagePrice.billableMetric - billingCycleConfiguration = groupedTieredPackagePrice.billingCycleConfiguration - cadence = groupedTieredPackagePrice.cadence - conversionRate = groupedTieredPackagePrice.conversionRate - createdAt = groupedTieredPackagePrice.createdAt - creditAllocation = groupedTieredPackagePrice.creditAllocation - currency = groupedTieredPackagePrice.currency - discount = groupedTieredPackagePrice.discount - externalPriceId = groupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = groupedTieredPackagePrice.fixedPriceQuantity - groupedTieredPackageConfig = groupedTieredPackagePrice.groupedTieredPackageConfig - invoicingCycleConfiguration = groupedTieredPackagePrice.invoicingCycleConfiguration - item = groupedTieredPackagePrice.item - maximum = groupedTieredPackagePrice.maximum - maximumAmount = groupedTieredPackagePrice.maximumAmount - metadata = groupedTieredPackagePrice.metadata - minimum = groupedTieredPackagePrice.minimum - minimumAmount = groupedTieredPackagePrice.minimumAmount - modelType = groupedTieredPackagePrice.modelType - name = groupedTieredPackagePrice.name - planPhaseOrder = groupedTieredPackagePrice.planPhaseOrder - priceType = groupedTieredPackagePrice.priceType - dimensionalPriceConfiguration = - groupedTieredPackagePrice.dimensionalPriceConfiguration - additionalProperties = groupedTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + id = groupedTieredPackage.id + billableMetric = groupedTieredPackage.billableMetric + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + cadence = groupedTieredPackage.cadence + conversionRate = groupedTieredPackage.conversionRate + createdAt = groupedTieredPackage.createdAt + creditAllocation = groupedTieredPackage.creditAllocation + currency = groupedTieredPackage.currency + discount = groupedTieredPackage.discount + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + invoicingCycleConfiguration = groupedTieredPackage.invoicingCycleConfiguration + item = groupedTieredPackage.item + maximum = groupedTieredPackage.maximum + maximumAmount = groupedTieredPackage.maximumAmount + metadata = groupedTieredPackage.metadata + minimum = groupedTieredPackage.minimum + minimumAmount = groupedTieredPackage.minimumAmount + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + planPhaseOrder = groupedTieredPackage.planPhaseOrder + priceType = groupedTieredPackage.priceType + dimensionalPriceConfiguration = groupedTieredPackage.dimensionalPriceConfiguration + additionalProperties = groupedTieredPackage.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -88153,7 +88094,7 @@ private constructor( } /** - * Returns an immutable instance of [GroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -88185,8 +88126,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): GroupedTieredPackagePrice = - GroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -88217,7 +88158,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -90739,7 +90680,7 @@ private constructor( return true } - 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackage && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -90749,10 +90690,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedTieredPackage{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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class MaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -91250,8 +91191,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MaxGroupTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -91282,7 +91222,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -91313,34 +91253,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(maxGroupTieredPackagePrice: MaxGroupTieredPackagePrice) = apply { - id = maxGroupTieredPackagePrice.id - billableMetric = maxGroupTieredPackagePrice.billableMetric - billingCycleConfiguration = maxGroupTieredPackagePrice.billingCycleConfiguration - cadence = maxGroupTieredPackagePrice.cadence - conversionRate = maxGroupTieredPackagePrice.conversionRate - createdAt = maxGroupTieredPackagePrice.createdAt - creditAllocation = maxGroupTieredPackagePrice.creditAllocation - currency = maxGroupTieredPackagePrice.currency - discount = maxGroupTieredPackagePrice.discount - externalPriceId = maxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = maxGroupTieredPackagePrice.fixedPriceQuantity - invoicingCycleConfiguration = maxGroupTieredPackagePrice.invoicingCycleConfiguration - item = maxGroupTieredPackagePrice.item - maxGroupTieredPackageConfig = maxGroupTieredPackagePrice.maxGroupTieredPackageConfig - maximum = maxGroupTieredPackagePrice.maximum - maximumAmount = maxGroupTieredPackagePrice.maximumAmount - metadata = maxGroupTieredPackagePrice.metadata - minimum = maxGroupTieredPackagePrice.minimum - minimumAmount = maxGroupTieredPackagePrice.minimumAmount - modelType = maxGroupTieredPackagePrice.modelType - name = maxGroupTieredPackagePrice.name - planPhaseOrder = maxGroupTieredPackagePrice.planPhaseOrder - priceType = maxGroupTieredPackagePrice.priceType - dimensionalPriceConfiguration = - maxGroupTieredPackagePrice.dimensionalPriceConfiguration - additionalProperties = - maxGroupTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + id = maxGroupTieredPackage.id + billableMetric = maxGroupTieredPackage.billableMetric + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + cadence = maxGroupTieredPackage.cadence + conversionRate = maxGroupTieredPackage.conversionRate + createdAt = maxGroupTieredPackage.createdAt + creditAllocation = maxGroupTieredPackage.creditAllocation + currency = maxGroupTieredPackage.currency + discount = maxGroupTieredPackage.discount + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoicingCycleConfiguration = maxGroupTieredPackage.invoicingCycleConfiguration + item = maxGroupTieredPackage.item + maxGroupTieredPackageConfig = maxGroupTieredPackage.maxGroupTieredPackageConfig + maximum = maxGroupTieredPackage.maximum + maximumAmount = maxGroupTieredPackage.maximumAmount + metadata = maxGroupTieredPackage.metadata + minimum = maxGroupTieredPackage.minimum + minimumAmount = maxGroupTieredPackage.minimumAmount + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + planPhaseOrder = maxGroupTieredPackage.planPhaseOrder + priceType = maxGroupTieredPackage.priceType + dimensionalPriceConfiguration = maxGroupTieredPackage.dimensionalPriceConfiguration + additionalProperties = maxGroupTieredPackage.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -91790,7 +91728,7 @@ private constructor( } /** - * Returns an immutable instance of [MaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -91822,8 +91760,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): MaxGroupTieredPackagePrice = - MaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -91854,7 +91792,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -94377,7 +94315,7 @@ private constructor( return true } - return /* spotless:off */ other is MaxGroupTieredPackagePrice && 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 && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaxGroupTieredPackage && 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 && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -94387,10 +94325,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MaxGroupTieredPackagePrice{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, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "MaxGroupTieredPackage{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, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class ScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -94893,7 +94831,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [ScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -94924,7 +94862,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -94957,40 +94895,39 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - scalableMatrixWithUnitPricingPrice: ScalableMatrixWithUnitPricingPrice - ) = apply { - id = scalableMatrixWithUnitPricingPrice.id - billableMetric = scalableMatrixWithUnitPricingPrice.billableMetric - billingCycleConfiguration = - scalableMatrixWithUnitPricingPrice.billingCycleConfiguration - cadence = scalableMatrixWithUnitPricingPrice.cadence - conversionRate = scalableMatrixWithUnitPricingPrice.conversionRate - createdAt = scalableMatrixWithUnitPricingPrice.createdAt - creditAllocation = scalableMatrixWithUnitPricingPrice.creditAllocation - currency = scalableMatrixWithUnitPricingPrice.currency - discount = scalableMatrixWithUnitPricingPrice.discount - externalPriceId = scalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = scalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoicingCycleConfiguration = - scalableMatrixWithUnitPricingPrice.invoicingCycleConfiguration - item = scalableMatrixWithUnitPricingPrice.item - maximum = scalableMatrixWithUnitPricingPrice.maximum - maximumAmount = scalableMatrixWithUnitPricingPrice.maximumAmount - metadata = scalableMatrixWithUnitPricingPrice.metadata - minimum = scalableMatrixWithUnitPricingPrice.minimum - minimumAmount = scalableMatrixWithUnitPricingPrice.minimumAmount - modelType = scalableMatrixWithUnitPricingPrice.modelType - name = scalableMatrixWithUnitPricingPrice.name - planPhaseOrder = scalableMatrixWithUnitPricingPrice.planPhaseOrder - priceType = scalableMatrixWithUnitPricingPrice.priceType - scalableMatrixWithUnitPricingConfig = - scalableMatrixWithUnitPricingPrice.scalableMatrixWithUnitPricingConfig - dimensionalPriceConfiguration = - scalableMatrixWithUnitPricingPrice.dimensionalPriceConfiguration - additionalProperties = - scalableMatrixWithUnitPricingPrice.additionalProperties.toMutableMap() - } + internal fun from(scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing) = + apply { + id = scalableMatrixWithUnitPricing.id + billableMetric = scalableMatrixWithUnitPricing.billableMetric + billingCycleConfiguration = + scalableMatrixWithUnitPricing.billingCycleConfiguration + cadence = scalableMatrixWithUnitPricing.cadence + conversionRate = scalableMatrixWithUnitPricing.conversionRate + createdAt = scalableMatrixWithUnitPricing.createdAt + creditAllocation = scalableMatrixWithUnitPricing.creditAllocation + currency = scalableMatrixWithUnitPricing.currency + discount = scalableMatrixWithUnitPricing.discount + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoicingCycleConfiguration = + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + item = scalableMatrixWithUnitPricing.item + maximum = scalableMatrixWithUnitPricing.maximum + maximumAmount = scalableMatrixWithUnitPricing.maximumAmount + metadata = scalableMatrixWithUnitPricing.metadata + minimum = scalableMatrixWithUnitPricing.minimum + minimumAmount = scalableMatrixWithUnitPricing.minimumAmount + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name + planPhaseOrder = scalableMatrixWithUnitPricing.planPhaseOrder + priceType = scalableMatrixWithUnitPricing.priceType + scalableMatrixWithUnitPricingConfig = + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + dimensionalPriceConfiguration = + scalableMatrixWithUnitPricing.dimensionalPriceConfiguration + additionalProperties = + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -95444,7 +95381,7 @@ private constructor( } /** - * Returns an immutable instance of [ScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -95476,8 +95413,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ScalableMatrixWithUnitPricingPrice = - ScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -95511,7 +95448,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -98037,7 +97974,7 @@ private constructor( return true } - return /* spotless:off */ other is ScalableMatrixWithUnitPricingPrice && 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 && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && 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 && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -98047,10 +97984,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ScalableMatrixWithUnitPricingPrice{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, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{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, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class ScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -98554,7 +98491,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [ScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -98585,7 +98522,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -98618,40 +98555,39 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - scalableMatrixWithTieredPricingPrice: ScalableMatrixWithTieredPricingPrice - ) = apply { - id = scalableMatrixWithTieredPricingPrice.id - billableMetric = scalableMatrixWithTieredPricingPrice.billableMetric - billingCycleConfiguration = - scalableMatrixWithTieredPricingPrice.billingCycleConfiguration - cadence = scalableMatrixWithTieredPricingPrice.cadence - conversionRate = scalableMatrixWithTieredPricingPrice.conversionRate - createdAt = scalableMatrixWithTieredPricingPrice.createdAt - creditAllocation = scalableMatrixWithTieredPricingPrice.creditAllocation - currency = scalableMatrixWithTieredPricingPrice.currency - discount = scalableMatrixWithTieredPricingPrice.discount - externalPriceId = scalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = scalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoicingCycleConfiguration = - scalableMatrixWithTieredPricingPrice.invoicingCycleConfiguration - item = scalableMatrixWithTieredPricingPrice.item - maximum = scalableMatrixWithTieredPricingPrice.maximum - maximumAmount = scalableMatrixWithTieredPricingPrice.maximumAmount - metadata = scalableMatrixWithTieredPricingPrice.metadata - minimum = scalableMatrixWithTieredPricingPrice.minimum - minimumAmount = scalableMatrixWithTieredPricingPrice.minimumAmount - modelType = scalableMatrixWithTieredPricingPrice.modelType - name = scalableMatrixWithTieredPricingPrice.name - planPhaseOrder = scalableMatrixWithTieredPricingPrice.planPhaseOrder - priceType = scalableMatrixWithTieredPricingPrice.priceType - scalableMatrixWithTieredPricingConfig = - scalableMatrixWithTieredPricingPrice.scalableMatrixWithTieredPricingConfig - dimensionalPriceConfiguration = - scalableMatrixWithTieredPricingPrice.dimensionalPriceConfiguration - additionalProperties = - scalableMatrixWithTieredPricingPrice.additionalProperties.toMutableMap() - } + internal fun from(scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing) = + apply { + id = scalableMatrixWithTieredPricing.id + billableMetric = scalableMatrixWithTieredPricing.billableMetric + billingCycleConfiguration = + scalableMatrixWithTieredPricing.billingCycleConfiguration + cadence = scalableMatrixWithTieredPricing.cadence + conversionRate = scalableMatrixWithTieredPricing.conversionRate + createdAt = scalableMatrixWithTieredPricing.createdAt + creditAllocation = scalableMatrixWithTieredPricing.creditAllocation + currency = scalableMatrixWithTieredPricing.currency + discount = scalableMatrixWithTieredPricing.discount + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoicingCycleConfiguration = + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + item = scalableMatrixWithTieredPricing.item + maximum = scalableMatrixWithTieredPricing.maximum + maximumAmount = scalableMatrixWithTieredPricing.maximumAmount + metadata = scalableMatrixWithTieredPricing.metadata + minimum = scalableMatrixWithTieredPricing.minimum + minimumAmount = scalableMatrixWithTieredPricing.minimumAmount + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name + planPhaseOrder = scalableMatrixWithTieredPricing.planPhaseOrder + priceType = scalableMatrixWithTieredPricing.priceType + scalableMatrixWithTieredPricingConfig = + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + dimensionalPriceConfiguration = + scalableMatrixWithTieredPricing.dimensionalPriceConfiguration + additionalProperties = + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -99106,7 +99042,7 @@ private constructor( } /** - * Returns an immutable instance of [ScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -99138,8 +99074,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ScalableMatrixWithTieredPricingPrice = - ScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -99173,7 +99109,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -101699,7 +101635,7 @@ private constructor( return true } - return /* spotless:off */ other is ScalableMatrixWithTieredPricingPrice && 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 && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && 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 && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -101709,10 +101645,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ScalableMatrixWithTieredPricingPrice{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, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{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, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } - class CumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val id: JsonField, private val billableMetric: JsonField, @@ -102210,8 +102146,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CumulativeGroupedBulkPrice]. + * Returns a mutable builder for constructing an instance of [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -102242,7 +102177,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -102273,34 +102208,32 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cumulativeGroupedBulkPrice: CumulativeGroupedBulkPrice) = apply { - id = cumulativeGroupedBulkPrice.id - billableMetric = cumulativeGroupedBulkPrice.billableMetric - billingCycleConfiguration = cumulativeGroupedBulkPrice.billingCycleConfiguration - cadence = cumulativeGroupedBulkPrice.cadence - conversionRate = cumulativeGroupedBulkPrice.conversionRate - createdAt = cumulativeGroupedBulkPrice.createdAt - creditAllocation = cumulativeGroupedBulkPrice.creditAllocation - cumulativeGroupedBulkConfig = cumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - currency = cumulativeGroupedBulkPrice.currency - discount = cumulativeGroupedBulkPrice.discount - externalPriceId = cumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = cumulativeGroupedBulkPrice.fixedPriceQuantity - invoicingCycleConfiguration = cumulativeGroupedBulkPrice.invoicingCycleConfiguration - item = cumulativeGroupedBulkPrice.item - maximum = cumulativeGroupedBulkPrice.maximum - maximumAmount = cumulativeGroupedBulkPrice.maximumAmount - metadata = cumulativeGroupedBulkPrice.metadata - minimum = cumulativeGroupedBulkPrice.minimum - minimumAmount = cumulativeGroupedBulkPrice.minimumAmount - modelType = cumulativeGroupedBulkPrice.modelType - name = cumulativeGroupedBulkPrice.name - planPhaseOrder = cumulativeGroupedBulkPrice.planPhaseOrder - priceType = cumulativeGroupedBulkPrice.priceType - dimensionalPriceConfiguration = - cumulativeGroupedBulkPrice.dimensionalPriceConfiguration - additionalProperties = - cumulativeGroupedBulkPrice.additionalProperties.toMutableMap() + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + id = cumulativeGroupedBulk.id + billableMetric = cumulativeGroupedBulk.billableMetric + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + cadence = cumulativeGroupedBulk.cadence + conversionRate = cumulativeGroupedBulk.conversionRate + createdAt = cumulativeGroupedBulk.createdAt + creditAllocation = cumulativeGroupedBulk.creditAllocation + cumulativeGroupedBulkConfig = cumulativeGroupedBulk.cumulativeGroupedBulkConfig + currency = cumulativeGroupedBulk.currency + discount = cumulativeGroupedBulk.discount + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoicingCycleConfiguration = cumulativeGroupedBulk.invoicingCycleConfiguration + item = cumulativeGroupedBulk.item + maximum = cumulativeGroupedBulk.maximum + maximumAmount = cumulativeGroupedBulk.maximumAmount + metadata = cumulativeGroupedBulk.metadata + minimum = cumulativeGroupedBulk.minimum + minimumAmount = cumulativeGroupedBulk.minimumAmount + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + planPhaseOrder = cumulativeGroupedBulk.planPhaseOrder + priceType = cumulativeGroupedBulk.priceType + dimensionalPriceConfiguration = cumulativeGroupedBulk.dimensionalPriceConfiguration + additionalProperties = cumulativeGroupedBulk.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -102750,7 +102683,7 @@ private constructor( } /** - * Returns an immutable instance of [CumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -102782,8 +102715,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): CumulativeGroupedBulkPrice = - CumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -102814,7 +102747,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -105337,7 +105270,7 @@ private constructor( return true } - return /* spotless:off */ other is CumulativeGroupedBulkPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CumulativeGroupedBulk && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -105347,6 +105280,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CumulativeGroupedBulkPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "CumulativeGroupedBulk{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, 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 575362b1d..5e64c79e0 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 @@ -89,238 +89,122 @@ private constructor( fun body(body: Body) = apply { this.body = body } - /** Alias for calling [body] with `Body.ofNewFloatingUnitPrice(newFloatingUnitPrice)`. */ - fun body(newFloatingUnitPrice: Body.NewFloatingUnitPrice) = - body(Body.ofNewFloatingUnitPrice(newFloatingUnitPrice)) + /** Alias for calling [body] with `Body.ofUnit(unit)`. */ + fun body(unit: Body.Unit) = body(Body.ofUnit(unit)) - /** - * Alias for calling [body] with `Body.ofNewFloatingPackagePrice(newFloatingPackagePrice)`. - */ - fun body(newFloatingPackagePrice: Body.NewFloatingPackagePrice) = - body(Body.ofNewFloatingPackagePrice(newFloatingPackagePrice)) + /** Alias for calling [body] with `Body.ofPackage(package_)`. */ + fun body(package_: Body.Package) = body(Body.ofPackage(package_)) - /** - * Alias for calling [body] with `Body.ofNewFloatingMatrixPrice(newFloatingMatrixPrice)`. - */ - fun body(newFloatingMatrixPrice: Body.NewFloatingMatrixPrice) = - body(Body.ofNewFloatingMatrixPrice(newFloatingMatrixPrice)) + /** Alias for calling [body] with `Body.ofMatrix(matrix)`. */ + fun body(matrix: Body.Matrix) = body(Body.ofMatrix(matrix)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingMatrixWithAllocationPrice(newFloatingMatrixWithAllocationPrice)`. - */ - fun body(newFloatingMatrixWithAllocationPrice: Body.NewFloatingMatrixWithAllocationPrice) = - body(Body.ofNewFloatingMatrixWithAllocationPrice(newFloatingMatrixWithAllocationPrice)) + /** Alias for calling [body] with `Body.ofMatrixWithAllocation(matrixWithAllocation)`. */ + fun body(matrixWithAllocation: Body.MatrixWithAllocation) = + body(Body.ofMatrixWithAllocation(matrixWithAllocation)) - /** - * Alias for calling [body] with `Body.ofNewFloatingTieredPrice(newFloatingTieredPrice)`. - */ - fun body(newFloatingTieredPrice: Body.NewFloatingTieredPrice) = - body(Body.ofNewFloatingTieredPrice(newFloatingTieredPrice)) + /** Alias for calling [body] with `Body.ofTiered(tiered)`. */ + fun body(tiered: Body.Tiered) = body(Body.ofTiered(tiered)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice)`. - */ - fun body(newFloatingTieredBpsPrice: Body.NewFloatingTieredBpsPrice) = - body(Body.ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice)) + /** Alias for calling [body] with `Body.ofTieredBps(tieredBps)`. */ + fun body(tieredBps: Body.TieredBps) = body(Body.ofTieredBps(tieredBps)) - /** Alias for calling [body] with `Body.ofNewFloatingBpsPrice(newFloatingBpsPrice)`. */ - fun body(newFloatingBpsPrice: Body.NewFloatingBpsPrice) = - body(Body.ofNewFloatingBpsPrice(newFloatingBpsPrice)) + /** Alias for calling [body] with `Body.ofBps(bps)`. */ + fun body(bps: Body.Bps) = body(Body.ofBps(bps)) - /** - * Alias for calling [body] with `Body.ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice)`. - */ - fun body(newFloatingBulkBpsPrice: Body.NewFloatingBulkBpsPrice) = - body(Body.ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice)) + /** Alias for calling [body] with `Body.ofBulkBps(bulkBps)`. */ + fun body(bulkBps: Body.BulkBps) = body(Body.ofBulkBps(bulkBps)) - /** Alias for calling [body] with `Body.ofNewFloatingBulkPrice(newFloatingBulkPrice)`. */ - fun body(newFloatingBulkPrice: Body.NewFloatingBulkPrice) = - body(Body.ofNewFloatingBulkPrice(newFloatingBulkPrice)) + /** Alias for calling [body] with `Body.ofBulk(bulk)`. */ + fun body(bulk: Body.Bulk) = body(Body.ofBulk(bulk)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingThresholdTotalAmountPrice(newFloatingThresholdTotalAmountPrice)`. - */ - fun body(newFloatingThresholdTotalAmountPrice: Body.NewFloatingThresholdTotalAmountPrice) = - body(Body.ofNewFloatingThresholdTotalAmountPrice(newFloatingThresholdTotalAmountPrice)) + /** Alias for calling [body] with `Body.ofThresholdTotalAmount(thresholdTotalAmount)`. */ + fun body(thresholdTotalAmount: Body.ThresholdTotalAmount) = + body(Body.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice)`. - */ - fun body(newFloatingTieredPackagePrice: Body.NewFloatingTieredPackagePrice) = - body(Body.ofNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice)) + /** Alias for calling [body] with `Body.ofTieredPackage(tieredPackage)`. */ + fun body(tieredPackage: Body.TieredPackage) = body(Body.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice)`. - */ - fun body(newFloatingGroupedTieredPrice: Body.NewFloatingGroupedTieredPrice) = - body(Body.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice)) + /** Alias for calling [body] with `Body.ofGroupedTiered(groupedTiered)`. */ + fun body(groupedTiered: Body.GroupedTiered) = body(Body.ofGroupedTiered(groupedTiered)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingMaxGroupTieredPackagePrice(newFloatingMaxGroupTieredPackagePrice)`. - */ - fun body( - newFloatingMaxGroupTieredPackagePrice: Body.NewFloatingMaxGroupTieredPackagePrice - ) = - body( - Body.ofNewFloatingMaxGroupTieredPackagePrice(newFloatingMaxGroupTieredPackagePrice) - ) + /** Alias for calling [body] with `Body.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ + fun body(maxGroupTieredPackage: Body.MaxGroupTieredPackage) = + body(Body.ofMaxGroupTieredPackage(maxGroupTieredPackage)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingTieredWithMinimumPrice(newFloatingTieredWithMinimumPrice)`. - */ - fun body(newFloatingTieredWithMinimumPrice: Body.NewFloatingTieredWithMinimumPrice) = - body(Body.ofNewFloatingTieredWithMinimumPrice(newFloatingTieredWithMinimumPrice)) + /** Alias for calling [body] with `Body.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun body(tieredWithMinimum: Body.TieredWithMinimum) = + body(Body.ofTieredWithMinimum(tieredWithMinimum)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingPackageWithAllocationPrice(newFloatingPackageWithAllocationPrice)`. - */ - fun body( - newFloatingPackageWithAllocationPrice: Body.NewFloatingPackageWithAllocationPrice - ) = - body( - Body.ofNewFloatingPackageWithAllocationPrice(newFloatingPackageWithAllocationPrice) - ) + /** Alias for calling [body] with `Body.ofPackageWithAllocation(packageWithAllocation)`. */ + fun body(packageWithAllocation: Body.PackageWithAllocation) = + body(Body.ofPackageWithAllocation(packageWithAllocation)) /** * Alias for calling [body] with - * `Body.ofNewFloatingTieredPackageWithMinimumPrice(newFloatingTieredPackageWithMinimumPrice)`. + * `Body.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun body( - newFloatingTieredPackageWithMinimumPrice: Body.NewFloatingTieredPackageWithMinimumPrice - ) = - body( - Body.ofNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice - ) - ) + fun body(tieredPackageWithMinimum: Body.TieredPackageWithMinimum) = + body(Body.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice)`. - */ - fun body(newFloatingUnitWithPercentPrice: Body.NewFloatingUnitWithPercentPrice) = - body(Body.ofNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice)) + /** Alias for calling [body] with `Body.ofUnitWithPercent(unitWithPercent)`. */ + fun body(unitWithPercent: Body.UnitWithPercent) = + body(Body.ofUnitWithPercent(unitWithPercent)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingTieredWithProrationPrice(newFloatingTieredWithProrationPrice)`. - */ - fun body(newFloatingTieredWithProrationPrice: Body.NewFloatingTieredWithProrationPrice) = - body(Body.ofNewFloatingTieredWithProrationPrice(newFloatingTieredWithProrationPrice)) + /** Alias for calling [body] with `Body.ofTieredWithProration(tieredWithProration)`. */ + fun body(tieredWithProration: Body.TieredWithProration) = + body(Body.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingUnitWithProrationPrice(newFloatingUnitWithProrationPrice)`. - */ - fun body(newFloatingUnitWithProrationPrice: Body.NewFloatingUnitWithProrationPrice) = - body(Body.ofNewFloatingUnitWithProrationPrice(newFloatingUnitWithProrationPrice)) + /** Alias for calling [body] with `Body.ofUnitWithProration(unitWithProration)`. */ + fun body(unitWithProration: Body.UnitWithProration) = + body(Body.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingGroupedAllocationPrice(newFloatingGroupedAllocationPrice)`. - */ - fun body(newFloatingGroupedAllocationPrice: Body.NewFloatingGroupedAllocationPrice) = - body(Body.ofNewFloatingGroupedAllocationPrice(newFloatingGroupedAllocationPrice)) + /** Alias for calling [body] with `Body.ofGroupedAllocation(groupedAllocation)`. */ + fun body(groupedAllocation: Body.GroupedAllocation) = + body(Body.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [body] with - * `Body.ofNewFloatingGroupedWithProratedMinimumPrice(newFloatingGroupedWithProratedMinimumPrice)`. + * `Body.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun body( - newFloatingGroupedWithProratedMinimumPrice: - Body.NewFloatingGroupedWithProratedMinimumPrice - ) = - body( - Body.ofNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice - ) - ) + fun body(groupedWithProratedMinimum: Body.GroupedWithProratedMinimum) = + body(Body.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [body] with - * `Body.ofNewFloatingGroupedWithMeteredMinimumPrice(newFloatingGroupedWithMeteredMinimumPrice)`. + * `Body.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun body( - newFloatingGroupedWithMeteredMinimumPrice: - Body.NewFloatingGroupedWithMeteredMinimumPrice - ) = - body( - Body.ofNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice - ) - ) + fun body(groupedWithMeteredMinimum: Body.GroupedWithMeteredMinimum) = + body(Body.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingMatrixWithDisplayNamePrice(newFloatingMatrixWithDisplayNamePrice)`. - */ - fun body( - newFloatingMatrixWithDisplayNamePrice: Body.NewFloatingMatrixWithDisplayNamePrice - ) = - body( - Body.ofNewFloatingMatrixWithDisplayNamePrice(newFloatingMatrixWithDisplayNamePrice) - ) + /** Alias for calling [body] with `Body.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ + fun body(matrixWithDisplayName: Body.MatrixWithDisplayName) = + body(Body.ofMatrixWithDisplayName(matrixWithDisplayName)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingBulkWithProrationPrice(newFloatingBulkWithProrationPrice)`. - */ - fun body(newFloatingBulkWithProrationPrice: Body.NewFloatingBulkWithProrationPrice) = - body(Body.ofNewFloatingBulkWithProrationPrice(newFloatingBulkWithProrationPrice)) + /** Alias for calling [body] with `Body.ofBulkWithProration(bulkWithProration)`. */ + fun body(bulkWithProration: Body.BulkWithProration) = + body(Body.ofBulkWithProration(bulkWithProration)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingGroupedTieredPackagePrice(newFloatingGroupedTieredPackagePrice)`. - */ - fun body(newFloatingGroupedTieredPackagePrice: Body.NewFloatingGroupedTieredPackagePrice) = - body(Body.ofNewFloatingGroupedTieredPackagePrice(newFloatingGroupedTieredPackagePrice)) + /** Alias for calling [body] with `Body.ofGroupedTieredPackage(groupedTieredPackage)`. */ + fun body(groupedTieredPackage: Body.GroupedTieredPackage) = + body(Body.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [body] with - * `Body.ofNewFloatingScalableMatrixWithUnitPricingPrice(newFloatingScalableMatrixWithUnitPricingPrice)`. + * `Body.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun body( - newFloatingScalableMatrixWithUnitPricingPrice: - Body.NewFloatingScalableMatrixWithUnitPricingPrice - ) = - body( - Body.ofNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice - ) - ) + fun body(scalableMatrixWithUnitPricing: Body.ScalableMatrixWithUnitPricing) = + body(Body.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [body] with - * `Body.ofNewFloatingScalableMatrixWithTieredPricingPrice(newFloatingScalableMatrixWithTieredPricingPrice)`. + * `Body.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun body( - newFloatingScalableMatrixWithTieredPricingPrice: - Body.NewFloatingScalableMatrixWithTieredPricingPrice - ) = - body( - Body.ofNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice - ) - ) + fun body(scalableMatrixWithTieredPricing: Body.ScalableMatrixWithTieredPricing) = + body(Body.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) - /** - * Alias for calling [body] with - * `Body.ofNewFloatingCumulativeGroupedBulkPrice(newFloatingCumulativeGroupedBulkPrice)`. - */ - fun body( - newFloatingCumulativeGroupedBulkPrice: Body.NewFloatingCumulativeGroupedBulkPrice - ) = - body( - Body.ofNewFloatingCumulativeGroupedBulkPrice(newFloatingCumulativeGroupedBulkPrice) - ) + /** Alias for calling [body] with `Body.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ + fun body(cumulativeGroupedBulk: Body.CumulativeGroupedBulk) = + body(Body.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -450,420 +334,283 @@ private constructor( @JsonSerialize(using = Body.Serializer::class) class Body private constructor( - private val newFloatingUnitPrice: NewFloatingUnitPrice? = null, - private val newFloatingPackagePrice: NewFloatingPackagePrice? = null, - private val newFloatingMatrixPrice: NewFloatingMatrixPrice? = null, - private val newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice? = - null, - private val newFloatingTieredPrice: NewFloatingTieredPrice? = null, - private val newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice? = null, - private val newFloatingBpsPrice: NewFloatingBpsPrice? = null, - private val newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice? = null, - private val newFloatingBulkPrice: NewFloatingBulkPrice? = null, - private val newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice? = - null, - private val newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice? = null, - private val newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice? = null, - private val newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice? = - null, - private val newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice? = null, - private val newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice? = - null, - private val newFloatingTieredPackageWithMinimumPrice: - NewFloatingTieredPackageWithMinimumPrice? = - null, - private val newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice? = null, - private val newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice? = - null, - private val newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice? = null, - private val newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice? = null, - private val newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice? = - null, - private val newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice? = - null, - private val newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice? = - null, - private val newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice? = null, - private val newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice? = - null, - private val newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice? = - null, - private val newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice? = - null, - private val newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice? = - null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val matrixWithAllocation: MatrixWithAllocation? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val groupedTiered: GroupedTiered? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredPackageWithMinimum: TieredPackageWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val bulkWithProration: BulkWithProration? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, private val _json: JsonValue? = null, ) { - fun newFloatingUnitPrice(): Optional = - Optional.ofNullable(newFloatingUnitPrice) + fun unit(): Optional = Optional.ofNullable(unit) - fun newFloatingPackagePrice(): Optional = - Optional.ofNullable(newFloatingPackagePrice) + fun package_(): Optional = Optional.ofNullable(package_) - fun newFloatingMatrixPrice(): Optional = - Optional.ofNullable(newFloatingMatrixPrice) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newFloatingMatrixWithAllocationPrice(): Optional = - Optional.ofNullable(newFloatingMatrixWithAllocationPrice) + fun matrixWithAllocation(): Optional = + Optional.ofNullable(matrixWithAllocation) - fun newFloatingTieredPrice(): Optional = - Optional.ofNullable(newFloatingTieredPrice) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newFloatingTieredBpsPrice(): Optional = - Optional.ofNullable(newFloatingTieredBpsPrice) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newFloatingBpsPrice(): Optional = - Optional.ofNullable(newFloatingBpsPrice) + fun bps(): Optional = Optional.ofNullable(bps) - fun newFloatingBulkBpsPrice(): Optional = - Optional.ofNullable(newFloatingBulkBpsPrice) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newFloatingBulkPrice(): Optional = - Optional.ofNullable(newFloatingBulkPrice) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newFloatingThresholdTotalAmountPrice(): Optional = - Optional.ofNullable(newFloatingThresholdTotalAmountPrice) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newFloatingTieredPackagePrice(): Optional = - Optional.ofNullable(newFloatingTieredPackagePrice) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newFloatingGroupedTieredPrice(): Optional = - Optional.ofNullable(newFloatingGroupedTieredPrice) + fun groupedTiered(): Optional = Optional.ofNullable(groupedTiered) - fun newFloatingMaxGroupTieredPackagePrice(): - Optional = - Optional.ofNullable(newFloatingMaxGroupTieredPackagePrice) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newFloatingTieredWithMinimumPrice(): Optional = - Optional.ofNullable(newFloatingTieredWithMinimumPrice) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newFloatingPackageWithAllocationPrice(): - Optional = - Optional.ofNullable(newFloatingPackageWithAllocationPrice) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newFloatingTieredPackageWithMinimumPrice(): - Optional = - Optional.ofNullable(newFloatingTieredPackageWithMinimumPrice) + fun tieredPackageWithMinimum(): Optional = + Optional.ofNullable(tieredPackageWithMinimum) - fun newFloatingUnitWithPercentPrice(): Optional = - Optional.ofNullable(newFloatingUnitWithPercentPrice) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newFloatingTieredWithProrationPrice(): Optional = - Optional.ofNullable(newFloatingTieredWithProrationPrice) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newFloatingUnitWithProrationPrice(): Optional = - Optional.ofNullable(newFloatingUnitWithProrationPrice) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newFloatingGroupedAllocationPrice(): Optional = - Optional.ofNullable(newFloatingGroupedAllocationPrice) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newFloatingGroupedWithProratedMinimumPrice(): - Optional = - Optional.ofNullable(newFloatingGroupedWithProratedMinimumPrice) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newFloatingGroupedWithMeteredMinimumPrice(): - Optional = - Optional.ofNullable(newFloatingGroupedWithMeteredMinimumPrice) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newFloatingMatrixWithDisplayNamePrice(): - Optional = - Optional.ofNullable(newFloatingMatrixWithDisplayNamePrice) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newFloatingBulkWithProrationPrice(): Optional = - Optional.ofNullable(newFloatingBulkWithProrationPrice) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newFloatingGroupedTieredPackagePrice(): Optional = - Optional.ofNullable(newFloatingGroupedTieredPackagePrice) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun newFloatingScalableMatrixWithUnitPricingPrice(): - Optional = - Optional.ofNullable(newFloatingScalableMatrixWithUnitPricingPrice) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newFloatingScalableMatrixWithTieredPricingPrice(): - Optional = - Optional.ofNullable(newFloatingScalableMatrixWithTieredPricingPrice) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newFloatingCumulativeGroupedBulkPrice(): - Optional = - Optional.ofNullable(newFloatingCumulativeGroupedBulkPrice) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun isNewFloatingUnitPrice(): Boolean = newFloatingUnitPrice != null + fun isUnit(): Boolean = unit != null - fun isNewFloatingPackagePrice(): Boolean = newFloatingPackagePrice != null + fun isPackage(): Boolean = package_ != null - fun isNewFloatingMatrixPrice(): Boolean = newFloatingMatrixPrice != null + fun isMatrix(): Boolean = matrix != null - fun isNewFloatingMatrixWithAllocationPrice(): Boolean = - newFloatingMatrixWithAllocationPrice != null + fun isMatrixWithAllocation(): Boolean = matrixWithAllocation != null - fun isNewFloatingTieredPrice(): Boolean = newFloatingTieredPrice != null + fun isTiered(): Boolean = tiered != null - fun isNewFloatingTieredBpsPrice(): Boolean = newFloatingTieredBpsPrice != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewFloatingBpsPrice(): Boolean = newFloatingBpsPrice != null + fun isBps(): Boolean = bps != null - fun isNewFloatingBulkBpsPrice(): Boolean = newFloatingBulkBpsPrice != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewFloatingBulkPrice(): Boolean = newFloatingBulkPrice != null + fun isBulk(): Boolean = bulk != null - fun isNewFloatingThresholdTotalAmountPrice(): Boolean = - newFloatingThresholdTotalAmountPrice != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewFloatingTieredPackagePrice(): Boolean = newFloatingTieredPackagePrice != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewFloatingGroupedTieredPrice(): Boolean = newFloatingGroupedTieredPrice != null + fun isGroupedTiered(): Boolean = groupedTiered != null - fun isNewFloatingMaxGroupTieredPackagePrice(): Boolean = - newFloatingMaxGroupTieredPackagePrice != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewFloatingTieredWithMinimumPrice(): Boolean = - newFloatingTieredWithMinimumPrice != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewFloatingPackageWithAllocationPrice(): Boolean = - newFloatingPackageWithAllocationPrice != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewFloatingTieredPackageWithMinimumPrice(): Boolean = - newFloatingTieredPackageWithMinimumPrice != null + fun isTieredPackageWithMinimum(): Boolean = tieredPackageWithMinimum != null - fun isNewFloatingUnitWithPercentPrice(): Boolean = newFloatingUnitWithPercentPrice != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewFloatingTieredWithProrationPrice(): Boolean = - newFloatingTieredWithProrationPrice != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewFloatingUnitWithProrationPrice(): Boolean = - newFloatingUnitWithProrationPrice != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewFloatingGroupedAllocationPrice(): Boolean = - newFloatingGroupedAllocationPrice != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewFloatingGroupedWithProratedMinimumPrice(): Boolean = - newFloatingGroupedWithProratedMinimumPrice != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewFloatingGroupedWithMeteredMinimumPrice(): Boolean = - newFloatingGroupedWithMeteredMinimumPrice != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewFloatingMatrixWithDisplayNamePrice(): Boolean = - newFloatingMatrixWithDisplayNamePrice != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewFloatingBulkWithProrationPrice(): Boolean = - newFloatingBulkWithProrationPrice != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewFloatingGroupedTieredPackagePrice(): Boolean = - newFloatingGroupedTieredPackagePrice != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun isNewFloatingScalableMatrixWithUnitPricingPrice(): Boolean = - newFloatingScalableMatrixWithUnitPricingPrice != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewFloatingScalableMatrixWithTieredPricingPrice(): Boolean = - newFloatingScalableMatrixWithTieredPricingPrice != null + fun isScalableMatrixWithTieredPricing(): Boolean = scalableMatrixWithTieredPricing != null - fun isNewFloatingCumulativeGroupedBulkPrice(): Boolean = - newFloatingCumulativeGroupedBulkPrice != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun asNewFloatingUnitPrice(): NewFloatingUnitPrice = - newFloatingUnitPrice.getOrThrow("newFloatingUnitPrice") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewFloatingPackagePrice(): NewFloatingPackagePrice = - newFloatingPackagePrice.getOrThrow("newFloatingPackagePrice") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewFloatingMatrixPrice(): NewFloatingMatrixPrice = - newFloatingMatrixPrice.getOrThrow("newFloatingMatrixPrice") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewFloatingMatrixWithAllocationPrice(): NewFloatingMatrixWithAllocationPrice = - newFloatingMatrixWithAllocationPrice.getOrThrow("newFloatingMatrixWithAllocationPrice") + fun asMatrixWithAllocation(): MatrixWithAllocation = + matrixWithAllocation.getOrThrow("matrixWithAllocation") - fun asNewFloatingTieredPrice(): NewFloatingTieredPrice = - newFloatingTieredPrice.getOrThrow("newFloatingTieredPrice") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewFloatingTieredBpsPrice(): NewFloatingTieredBpsPrice = - newFloatingTieredBpsPrice.getOrThrow("newFloatingTieredBpsPrice") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewFloatingBpsPrice(): NewFloatingBpsPrice = - newFloatingBpsPrice.getOrThrow("newFloatingBpsPrice") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewFloatingBulkBpsPrice(): NewFloatingBulkBpsPrice = - newFloatingBulkBpsPrice.getOrThrow("newFloatingBulkBpsPrice") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewFloatingBulkPrice(): NewFloatingBulkPrice = - newFloatingBulkPrice.getOrThrow("newFloatingBulkPrice") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewFloatingThresholdTotalAmountPrice(): NewFloatingThresholdTotalAmountPrice = - newFloatingThresholdTotalAmountPrice.getOrThrow("newFloatingThresholdTotalAmountPrice") + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewFloatingTieredPackagePrice(): NewFloatingTieredPackagePrice = - newFloatingTieredPackagePrice.getOrThrow("newFloatingTieredPackagePrice") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewFloatingGroupedTieredPrice(): NewFloatingGroupedTieredPrice = - newFloatingGroupedTieredPrice.getOrThrow("newFloatingGroupedTieredPrice") + fun asGroupedTiered(): GroupedTiered = groupedTiered.getOrThrow("groupedTiered") - fun asNewFloatingMaxGroupTieredPackagePrice(): NewFloatingMaxGroupTieredPackagePrice = - newFloatingMaxGroupTieredPackagePrice.getOrThrow( - "newFloatingMaxGroupTieredPackagePrice" - ) + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewFloatingTieredWithMinimumPrice(): NewFloatingTieredWithMinimumPrice = - newFloatingTieredWithMinimumPrice.getOrThrow("newFloatingTieredWithMinimumPrice") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewFloatingPackageWithAllocationPrice(): NewFloatingPackageWithAllocationPrice = - newFloatingPackageWithAllocationPrice.getOrThrow( - "newFloatingPackageWithAllocationPrice" - ) + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewFloatingTieredPackageWithMinimumPrice(): NewFloatingTieredPackageWithMinimumPrice = - newFloatingTieredPackageWithMinimumPrice.getOrThrow( - "newFloatingTieredPackageWithMinimumPrice" - ) + fun asTieredPackageWithMinimum(): TieredPackageWithMinimum = + tieredPackageWithMinimum.getOrThrow("tieredPackageWithMinimum") - fun asNewFloatingUnitWithPercentPrice(): NewFloatingUnitWithPercentPrice = - newFloatingUnitWithPercentPrice.getOrThrow("newFloatingUnitWithPercentPrice") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewFloatingTieredWithProrationPrice(): NewFloatingTieredWithProrationPrice = - newFloatingTieredWithProrationPrice.getOrThrow("newFloatingTieredWithProrationPrice") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewFloatingUnitWithProrationPrice(): NewFloatingUnitWithProrationPrice = - newFloatingUnitWithProrationPrice.getOrThrow("newFloatingUnitWithProrationPrice") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewFloatingGroupedAllocationPrice(): NewFloatingGroupedAllocationPrice = - newFloatingGroupedAllocationPrice.getOrThrow("newFloatingGroupedAllocationPrice") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewFloatingGroupedWithProratedMinimumPrice(): - NewFloatingGroupedWithProratedMinimumPrice = - newFloatingGroupedWithProratedMinimumPrice.getOrThrow( - "newFloatingGroupedWithProratedMinimumPrice" - ) + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewFloatingGroupedWithMeteredMinimumPrice(): - NewFloatingGroupedWithMeteredMinimumPrice = - newFloatingGroupedWithMeteredMinimumPrice.getOrThrow( - "newFloatingGroupedWithMeteredMinimumPrice" - ) + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewFloatingMatrixWithDisplayNamePrice(): NewFloatingMatrixWithDisplayNamePrice = - newFloatingMatrixWithDisplayNamePrice.getOrThrow( - "newFloatingMatrixWithDisplayNamePrice" - ) + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewFloatingBulkWithProrationPrice(): NewFloatingBulkWithProrationPrice = - newFloatingBulkWithProrationPrice.getOrThrow("newFloatingBulkWithProrationPrice") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewFloatingGroupedTieredPackagePrice(): NewFloatingGroupedTieredPackagePrice = - newFloatingGroupedTieredPackagePrice.getOrThrow("newFloatingGroupedTieredPackagePrice") + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") - fun asNewFloatingScalableMatrixWithUnitPricingPrice(): - NewFloatingScalableMatrixWithUnitPricingPrice = - newFloatingScalableMatrixWithUnitPricingPrice.getOrThrow( - "newFloatingScalableMatrixWithUnitPricingPrice" - ) + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewFloatingScalableMatrixWithTieredPricingPrice(): - NewFloatingScalableMatrixWithTieredPricingPrice = - newFloatingScalableMatrixWithTieredPricingPrice.getOrThrow( - "newFloatingScalableMatrixWithTieredPricingPrice" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewFloatingCumulativeGroupedBulkPrice(): NewFloatingCumulativeGroupedBulkPrice = - newFloatingCumulativeGroupedBulkPrice.getOrThrow( - "newFloatingCumulativeGroupedBulkPrice" - ) + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newFloatingUnitPrice != null -> - visitor.visitNewFloatingUnitPrice(newFloatingUnitPrice) - newFloatingPackagePrice != null -> - visitor.visitNewFloatingPackagePrice(newFloatingPackagePrice) - newFloatingMatrixPrice != null -> - visitor.visitNewFloatingMatrixPrice(newFloatingMatrixPrice) - newFloatingMatrixWithAllocationPrice != null -> - visitor.visitNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice - ) - newFloatingTieredPrice != null -> - visitor.visitNewFloatingTieredPrice(newFloatingTieredPrice) - newFloatingTieredBpsPrice != null -> - visitor.visitNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice) - newFloatingBpsPrice != null -> visitor.visitNewFloatingBpsPrice(newFloatingBpsPrice) - newFloatingBulkBpsPrice != null -> - visitor.visitNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice) - newFloatingBulkPrice != null -> - visitor.visitNewFloatingBulkPrice(newFloatingBulkPrice) - newFloatingThresholdTotalAmountPrice != null -> - visitor.visitNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice - ) - newFloatingTieredPackagePrice != null -> - visitor.visitNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice) - newFloatingGroupedTieredPrice != null -> - visitor.visitNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) - newFloatingMaxGroupTieredPackagePrice != null -> - visitor.visitNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice - ) - newFloatingTieredWithMinimumPrice != null -> - visitor.visitNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice - ) - newFloatingPackageWithAllocationPrice != null -> - visitor.visitNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice - ) - newFloatingTieredPackageWithMinimumPrice != null -> - visitor.visitNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice - ) - newFloatingUnitWithPercentPrice != null -> - visitor.visitNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice) - newFloatingTieredWithProrationPrice != null -> - visitor.visitNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice - ) - newFloatingUnitWithProrationPrice != null -> - visitor.visitNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice - ) - newFloatingGroupedAllocationPrice != null -> - visitor.visitNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice - ) - newFloatingGroupedWithProratedMinimumPrice != null -> - visitor.visitNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice - ) - newFloatingGroupedWithMeteredMinimumPrice != null -> - visitor.visitNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice - ) - newFloatingMatrixWithDisplayNamePrice != null -> - visitor.visitNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice - ) - newFloatingBulkWithProrationPrice != null -> - visitor.visitNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice - ) - newFloatingGroupedTieredPackagePrice != null -> - visitor.visitNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice - ) - newFloatingScalableMatrixWithUnitPricingPrice != null -> - visitor.visitNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice - ) - newFloatingScalableMatrixWithTieredPricingPrice != null -> - visitor.visitNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice - ) - newFloatingCumulativeGroupedBulkPrice != null -> - visitor.visitNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice - ) + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + matrixWithAllocation != null -> + visitor.visitMatrixWithAllocation(matrixWithAllocation) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + groupedTiered != null -> visitor.visitGroupedTiered(groupedTiered) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredPackageWithMinimum != null -> + visitor.visitTieredPackageWithMinimum(tieredPackageWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + tieredWithProration != null -> visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) else -> visitor.unknown(_json) } @@ -876,177 +623,142 @@ private constructor( accept( object : Visitor { - override fun visitNewFloatingUnitPrice( - newFloatingUnitPrice: NewFloatingUnitPrice - ) { - newFloatingUnitPrice.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewFloatingPackagePrice( - newFloatingPackagePrice: NewFloatingPackagePrice - ) { - newFloatingPackagePrice.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewFloatingMatrixPrice( - newFloatingMatrixPrice: NewFloatingMatrixPrice - ) { - newFloatingMatrixPrice.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice + override fun visitMatrixWithAllocation( + matrixWithAllocation: MatrixWithAllocation ) { - newFloatingMatrixWithAllocationPrice.validate() + matrixWithAllocation.validate() } - override fun visitNewFloatingTieredPrice( - newFloatingTieredPrice: NewFloatingTieredPrice - ) { - newFloatingTieredPrice.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewFloatingTieredBpsPrice( - newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice - ) { - newFloatingTieredBpsPrice.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewFloatingBpsPrice( - newFloatingBpsPrice: NewFloatingBpsPrice - ) { - newFloatingBpsPrice.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewFloatingBulkBpsPrice( - newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice - ) { - newFloatingBulkBpsPrice.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewFloatingBulkPrice( - newFloatingBulkPrice: NewFloatingBulkPrice - ) { - newFloatingBulkPrice.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newFloatingThresholdTotalAmountPrice.validate() + thresholdTotalAmount.validate() } - override fun visitNewFloatingTieredPackagePrice( - newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ) { - newFloatingTieredPackagePrice.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewFloatingGroupedTieredPrice( - newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ) { - newFloatingGroupedTieredPrice.validate() + override fun visitGroupedTiered(groupedTiered: GroupedTiered) { + groupedTiered.validate() } - override fun visitNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newFloatingMaxGroupTieredPackagePrice.validate() + maxGroupTieredPackage.validate() } - override fun visitNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) { - newFloatingTieredWithMinimumPrice.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newFloatingPackageWithAllocationPrice.validate() + packageWithAllocation.validate() } - override fun visitNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice: - NewFloatingTieredPackageWithMinimumPrice + override fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: TieredPackageWithMinimum ) { - newFloatingTieredPackageWithMinimumPrice.validate() + tieredPackageWithMinimum.validate() } - override fun visitNewFloatingUnitWithPercentPrice( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) { - newFloatingUnitWithPercentPrice.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newFloatingTieredWithProrationPrice.validate() + tieredWithProration.validate() } - override fun visitNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) { - newFloatingUnitWithProrationPrice.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) { - newFloatingGroupedAllocationPrice.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newFloatingGroupedWithProratedMinimumPrice.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newFloatingGroupedWithMeteredMinimumPrice.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newFloatingMatrixWithDisplayNamePrice.validate() + matrixWithDisplayName.validate() } - override fun visitNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) { - newFloatingBulkWithProrationPrice.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newFloatingGroupedTieredPackagePrice.validate() + groupedTieredPackage.validate() } - override fun visitNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newFloatingScalableMatrixWithUnitPricingPrice.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newFloatingScalableMatrixWithTieredPricingPrice.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newFloatingCumulativeGroupedBulkPrice.validate() + cumulativeGroupedBulk.validate() } } ) @@ -1071,122 +783,94 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewFloatingUnitPrice( - newFloatingUnitPrice: NewFloatingUnitPrice - ) = newFloatingUnitPrice.validity() - - override fun visitNewFloatingPackagePrice( - newFloatingPackagePrice: NewFloatingPackagePrice - ) = newFloatingPackagePrice.validity() - - override fun visitNewFloatingMatrixPrice( - newFloatingMatrixPrice: NewFloatingMatrixPrice - ) = newFloatingMatrixPrice.validity() - - override fun visitNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ) = newFloatingMatrixWithAllocationPrice.validity() - - override fun visitNewFloatingTieredPrice( - newFloatingTieredPrice: NewFloatingTieredPrice - ) = newFloatingTieredPrice.validity() - - override fun visitNewFloatingTieredBpsPrice( - newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice - ) = newFloatingTieredBpsPrice.validity() - - override fun visitNewFloatingBpsPrice( - newFloatingBpsPrice: NewFloatingBpsPrice - ) = newFloatingBpsPrice.validity() - - override fun visitNewFloatingBulkBpsPrice( - newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice - ) = newFloatingBulkBpsPrice.validity() - - override fun visitNewFloatingBulkPrice( - newFloatingBulkPrice: NewFloatingBulkPrice - ) = newFloatingBulkPrice.validity() - - override fun visitNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ) = newFloatingThresholdTotalAmountPrice.validity() - - override fun visitNewFloatingTieredPackagePrice( - newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ) = newFloatingTieredPackagePrice.validity() - - override fun visitNewFloatingGroupedTieredPrice( - newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ) = newFloatingGroupedTieredPrice.validity() - - override fun visitNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ) = newFloatingMaxGroupTieredPackagePrice.validity() - - override fun visitNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) = newFloatingTieredWithMinimumPrice.validity() - - override fun visitNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ) = newFloatingPackageWithAllocationPrice.validity() - - override fun visitNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice: - NewFloatingTieredPackageWithMinimumPrice - ) = newFloatingTieredPackageWithMinimumPrice.validity() - - override fun visitNewFloatingUnitWithPercentPrice( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) = newFloatingUnitWithPercentPrice.validity() - - override fun visitNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ) = newFloatingTieredWithProrationPrice.validity() - - override fun visitNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) = newFloatingUnitWithProrationPrice.validity() - - override fun visitNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) = newFloatingGroupedAllocationPrice.validity() - - override fun visitNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice - ) = newFloatingGroupedWithProratedMinimumPrice.validity() - - override fun visitNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice - ) = newFloatingGroupedWithMeteredMinimumPrice.validity() - - override fun visitNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ) = newFloatingMatrixWithDisplayNamePrice.validity() - - override fun visitNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) = newFloatingBulkWithProrationPrice.validity() - - override fun visitNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ) = newFloatingGroupedTieredPackagePrice.validity() + override fun visitUnit(unit: Unit) = unit.validity() + + override fun visitPackage(package_: Package) = package_.validity() + + override fun visitMatrix(matrix: Matrix) = matrix.validity() + + override fun visitMatrixWithAllocation( + matrixWithAllocation: MatrixWithAllocation + ) = matrixWithAllocation.validity() + + override fun visitTiered(tiered: Tiered) = tiered.validity() + + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() + + override fun visitBps(bps: Bps) = bps.validity() + + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() + + override fun visitBulk(bulk: Bulk) = bulk.validity() - override fun visitNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice - ) = newFloatingScalableMatrixWithUnitPricingPrice.validity() + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() - override fun visitNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice - ) = newFloatingScalableMatrixWithTieredPricingPrice.validity() - - override fun visitNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ) = newFloatingCumulativeGroupedBulkPrice.validity() + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() + + override fun visitGroupedTiered(groupedTiered: GroupedTiered) = + groupedTiered.validity() + + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() + + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() + + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() + + override fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: TieredPackageWithMinimum + ) = tieredPackageWithMinimum.validity() + + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() + + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() + + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() + + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() + + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() + + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() + + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() + + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() + + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() + + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() + + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() + + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() override fun unknown(json: JsonValue?) = 0 } @@ -1197,331 +881,220 @@ private constructor( return true } - return /* spotless:off */ other is Body && newFloatingUnitPrice == other.newFloatingUnitPrice && newFloatingPackagePrice == other.newFloatingPackagePrice && newFloatingMatrixPrice == other.newFloatingMatrixPrice && newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && newFloatingTieredPrice == other.newFloatingTieredPrice && newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && newFloatingBpsPrice == other.newFloatingBpsPrice && newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && newFloatingBulkPrice == other.newFloatingBulkPrice && newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && newFloatingMaxGroupTieredPackagePrice == other.newFloatingMaxGroupTieredPackagePrice && newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice && newFloatingScalableMatrixWithUnitPricingPrice == other.newFloatingScalableMatrixWithUnitPricingPrice && newFloatingScalableMatrixWithTieredPricingPrice == other.newFloatingScalableMatrixWithTieredPricingPrice && newFloatingCumulativeGroupedBulkPrice == other.newFloatingCumulativeGroupedBulkPrice /* spotless:on */ + return /* spotless:off */ other is Body && unit == other.unit && package_ == other.package_ && matrix == other.matrix && matrixWithAllocation == other.matrixWithAllocation && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && groupedTiered == other.groupedTiered && maxGroupTieredPackage == other.maxGroupTieredPackage && tieredWithMinimum == other.tieredWithMinimum && packageWithAllocation == other.packageWithAllocation && tieredPackageWithMinimum == other.tieredPackageWithMinimum && unitWithPercent == other.unitWithPercent && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingMaxGroupTieredPackagePrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice, newFloatingScalableMatrixWithUnitPricingPrice, newFloatingScalableMatrixWithTieredPricingPrice, newFloatingCumulativeGroupedBulkPrice) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, matrixWithAllocation, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, groupedTiered, maxGroupTieredPackage, tieredWithMinimum, packageWithAllocation, tieredPackageWithMinimum, unitWithPercent, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk) /* spotless:on */ override fun toString(): String = when { - newFloatingUnitPrice != null -> "Body{newFloatingUnitPrice=$newFloatingUnitPrice}" - newFloatingPackagePrice != null -> - "Body{newFloatingPackagePrice=$newFloatingPackagePrice}" - newFloatingMatrixPrice != null -> - "Body{newFloatingMatrixPrice=$newFloatingMatrixPrice}" - newFloatingMatrixWithAllocationPrice != null -> - "Body{newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice}" - newFloatingTieredPrice != null -> - "Body{newFloatingTieredPrice=$newFloatingTieredPrice}" - newFloatingTieredBpsPrice != null -> - "Body{newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice}" - newFloatingBpsPrice != null -> "Body{newFloatingBpsPrice=$newFloatingBpsPrice}" - newFloatingBulkBpsPrice != null -> - "Body{newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice}" - newFloatingBulkPrice != null -> "Body{newFloatingBulkPrice=$newFloatingBulkPrice}" - newFloatingThresholdTotalAmountPrice != null -> - "Body{newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice}" - newFloatingTieredPackagePrice != null -> - "Body{newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice}" - newFloatingGroupedTieredPrice != null -> - "Body{newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice}" - newFloatingMaxGroupTieredPackagePrice != null -> - "Body{newFloatingMaxGroupTieredPackagePrice=$newFloatingMaxGroupTieredPackagePrice}" - newFloatingTieredWithMinimumPrice != null -> - "Body{newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice}" - newFloatingPackageWithAllocationPrice != null -> - "Body{newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice}" - newFloatingTieredPackageWithMinimumPrice != null -> - "Body{newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice}" - newFloatingUnitWithPercentPrice != null -> - "Body{newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice}" - newFloatingTieredWithProrationPrice != null -> - "Body{newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice}" - newFloatingUnitWithProrationPrice != null -> - "Body{newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice}" - newFloatingGroupedAllocationPrice != null -> - "Body{newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice}" - newFloatingGroupedWithProratedMinimumPrice != null -> - "Body{newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice}" - newFloatingGroupedWithMeteredMinimumPrice != null -> - "Body{newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice}" - newFloatingMatrixWithDisplayNamePrice != null -> - "Body{newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice}" - newFloatingBulkWithProrationPrice != null -> - "Body{newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice}" - newFloatingGroupedTieredPackagePrice != null -> - "Body{newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice}" - newFloatingScalableMatrixWithUnitPricingPrice != null -> - "Body{newFloatingScalableMatrixWithUnitPricingPrice=$newFloatingScalableMatrixWithUnitPricingPrice}" - newFloatingScalableMatrixWithTieredPricingPrice != null -> - "Body{newFloatingScalableMatrixWithTieredPricingPrice=$newFloatingScalableMatrixWithTieredPricingPrice}" - newFloatingCumulativeGroupedBulkPrice != null -> - "Body{newFloatingCumulativeGroupedBulkPrice=$newFloatingCumulativeGroupedBulkPrice}" + unit != null -> "Body{unit=$unit}" + package_ != null -> "Body{package_=$package_}" + matrix != null -> "Body{matrix=$matrix}" + matrixWithAllocation != null -> "Body{matrixWithAllocation=$matrixWithAllocation}" + tiered != null -> "Body{tiered=$tiered}" + tieredBps != null -> "Body{tieredBps=$tieredBps}" + bps != null -> "Body{bps=$bps}" + bulkBps != null -> "Body{bulkBps=$bulkBps}" + bulk != null -> "Body{bulk=$bulk}" + thresholdTotalAmount != null -> "Body{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Body{tieredPackage=$tieredPackage}" + groupedTiered != null -> "Body{groupedTiered=$groupedTiered}" + maxGroupTieredPackage != null -> + "Body{maxGroupTieredPackage=$maxGroupTieredPackage}" + tieredWithMinimum != null -> "Body{tieredWithMinimum=$tieredWithMinimum}" + packageWithAllocation != null -> + "Body{packageWithAllocation=$packageWithAllocation}" + tieredPackageWithMinimum != null -> + "Body{tieredPackageWithMinimum=$tieredPackageWithMinimum}" + unitWithPercent != null -> "Body{unitWithPercent=$unitWithPercent}" + tieredWithProration != null -> "Body{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Body{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Body{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Body{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + groupedWithMeteredMinimum != null -> + "Body{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Body{matrixWithDisplayName=$matrixWithDisplayName}" + bulkWithProration != null -> "Body{bulkWithProration=$bulkWithProration}" + groupedTieredPackage != null -> "Body{groupedTieredPackage=$groupedTieredPackage}" + scalableMatrixWithUnitPricing != null -> + "Body{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Body{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Body{cumulativeGroupedBulk=$cumulativeGroupedBulk}" _json != null -> "Body{_unknown=$_json}" else -> throw IllegalStateException("Invalid Body") } companion object { - @JvmStatic - fun ofNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice) = - Body(newFloatingUnitPrice = newFloatingUnitPrice) + @JvmStatic fun ofUnit(unit: Unit) = Body(unit = unit) - @JvmStatic - fun ofNewFloatingPackagePrice(newFloatingPackagePrice: NewFloatingPackagePrice) = - Body(newFloatingPackagePrice = newFloatingPackagePrice) + @JvmStatic fun ofPackage(package_: Package) = Body(package_ = package_) - @JvmStatic - fun ofNewFloatingMatrixPrice(newFloatingMatrixPrice: NewFloatingMatrixPrice) = - Body(newFloatingMatrixPrice = newFloatingMatrixPrice) + @JvmStatic fun ofMatrix(matrix: Matrix) = Body(matrix = matrix) @JvmStatic - fun ofNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ) = Body(newFloatingMatrixWithAllocationPrice = newFloatingMatrixWithAllocationPrice) + fun ofMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation) = + Body(matrixWithAllocation = matrixWithAllocation) - @JvmStatic - fun ofNewFloatingTieredPrice(newFloatingTieredPrice: NewFloatingTieredPrice) = - Body(newFloatingTieredPrice = newFloatingTieredPrice) + @JvmStatic fun ofTiered(tiered: Tiered) = Body(tiered = tiered) - @JvmStatic - fun ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = - Body(newFloatingTieredBpsPrice = newFloatingTieredBpsPrice) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Body(tieredBps = tieredBps) - @JvmStatic - fun ofNewFloatingBpsPrice(newFloatingBpsPrice: NewFloatingBpsPrice) = - Body(newFloatingBpsPrice = newFloatingBpsPrice) + @JvmStatic fun ofBps(bps: Bps) = Body(bps = bps) - @JvmStatic - fun ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = - Body(newFloatingBulkBpsPrice = newFloatingBulkBpsPrice) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Body(bulkBps = bulkBps) - @JvmStatic - fun ofNewFloatingBulkPrice(newFloatingBulkPrice: NewFloatingBulkPrice) = - Body(newFloatingBulkPrice = newFloatingBulkPrice) + @JvmStatic fun ofBulk(bulk: Bulk) = Body(bulk = bulk) @JvmStatic - fun ofNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ) = Body(newFloatingThresholdTotalAmountPrice = newFloatingThresholdTotalAmountPrice) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Body(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewFloatingTieredPackagePrice( - newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ) = Body(newFloatingTieredPackagePrice = newFloatingTieredPackagePrice) + fun ofTieredPackage(tieredPackage: TieredPackage) = Body(tieredPackage = tieredPackage) @JvmStatic - fun ofNewFloatingGroupedTieredPrice( - newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ) = Body(newFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice) + fun ofGroupedTiered(groupedTiered: GroupedTiered) = Body(groupedTiered = groupedTiered) @JvmStatic - fun ofNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ) = Body(newFloatingMaxGroupTieredPackagePrice = newFloatingMaxGroupTieredPackagePrice) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Body(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) = Body(newFloatingTieredWithMinimumPrice = newFloatingTieredWithMinimumPrice) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Body(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ) = Body(newFloatingPackageWithAllocationPrice = newFloatingPackageWithAllocationPrice) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Body(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice - ) = - Body( - newFloatingTieredPackageWithMinimumPrice = - newFloatingTieredPackageWithMinimumPrice - ) + fun ofTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimum) = + Body(tieredPackageWithMinimum = tieredPackageWithMinimum) @JvmStatic - fun ofNewFloatingUnitWithPercentPrice( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) = Body(newFloatingUnitWithPercentPrice = newFloatingUnitWithPercentPrice) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Body(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ) = Body(newFloatingTieredWithProrationPrice = newFloatingTieredWithProrationPrice) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Body(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) = Body(newFloatingUnitWithProrationPrice = newFloatingUnitWithProrationPrice) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Body(unitWithProration = unitWithProration) @JvmStatic - fun ofNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) = Body(newFloatingGroupedAllocationPrice = newFloatingGroupedAllocationPrice) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Body(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice - ) = - Body( - newFloatingGroupedWithProratedMinimumPrice = - newFloatingGroupedWithProratedMinimumPrice - ) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Body(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice - ) = - Body( - newFloatingGroupedWithMeteredMinimumPrice = - newFloatingGroupedWithMeteredMinimumPrice - ) + fun ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + Body(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ) = Body(newFloatingMatrixWithDisplayNamePrice = newFloatingMatrixWithDisplayNamePrice) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Body(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) = Body(newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Body(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ) = Body(newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Body(groupedTieredPackage = groupedTieredPackage) @JvmStatic - fun ofNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice - ) = - Body( - newFloatingScalableMatrixWithUnitPricingPrice = - newFloatingScalableMatrixWithUnitPricingPrice - ) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Body(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice - ) = - Body( - newFloatingScalableMatrixWithTieredPricingPrice = - newFloatingScalableMatrixWithTieredPricingPrice - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Body(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ) = Body(newFloatingCumulativeGroupedBulkPrice = newFloatingCumulativeGroupedBulkPrice) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Body(cumulativeGroupedBulk = cumulativeGroupedBulk) } /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { - fun visitNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewFloatingPackagePrice(newFloatingPackagePrice: NewFloatingPackagePrice): T + fun visitPackage(package_: Package): T - fun visitNewFloatingMatrixPrice(newFloatingMatrixPrice: NewFloatingMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ): T + fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation): T - fun visitNewFloatingTieredPrice(newFloatingTieredPrice: NewFloatingTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewFloatingTieredBpsPrice( - newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice - ): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewFloatingBpsPrice(newFloatingBpsPrice: NewFloatingBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewFloatingBulkPrice(newFloatingBulkPrice: NewFloatingBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewFloatingTieredPackagePrice( - newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewFloatingGroupedTieredPrice( - newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ): T + fun visitGroupedTiered(groupedTiered: GroupedTiered): T - fun visitNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice - ): T + fun visitTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimum): T - fun visitNewFloatingUnitWithPercentPrice( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T - fun visitNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T /** * Maps an unknown variant of [Body] to a value of type [T]. @@ -1546,209 +1119,147 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Body(newFloatingUnitPrice = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(unit = it, _json = json) } ?: Body(_json = json) } "package" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(newFloatingPackagePrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(package_ = it, _json = json) + } ?: Body(_json = json) } "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Body(newFloatingMatrixPrice = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(matrix = it, _json = json) } ?: Body(_json = json) } "matrix_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingMatrixWithAllocationPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(matrixWithAllocation = it, _json = json) + } ?: Body(_json = json) } "tiered" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Body(newFloatingTieredPrice = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(tiered = it, _json = json) } ?: Body(_json = json) } "tiered_bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(newFloatingTieredBpsPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(tieredBps = it, _json = json) + } ?: Body(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Body(newFloatingBpsPrice = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(bps = it, _json = json) } ?: Body(_json = json) } "bulk_bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(newFloatingBulkBpsPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(bulkBps = it, _json = json) + } ?: Body(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Body(newFloatingBulkPrice = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(bulk = it, _json = json) } ?: Body(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingThresholdTotalAmountPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(thresholdTotalAmount = it, _json = json) + } ?: Body(_json = json) } "tiered_package" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(newFloatingTieredPackagePrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(tieredPackage = it, _json = json) + } ?: Body(_json = json) } "grouped_tiered" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(newFloatingGroupedTieredPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(groupedTiered = it, _json = json) + } ?: Body(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingMaxGroupTieredPackagePrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(maxGroupTieredPackage = it, _json = json) + } ?: Body(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingTieredWithMinimumPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(tieredWithMinimum = it, _json = json) + } ?: Body(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingPackageWithAllocationPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(packageWithAllocation = it, _json = json) + } ?: Body(_json = json) } "tiered_package_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(newFloatingTieredPackageWithMinimumPrice = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Body(tieredPackageWithMinimum = it, _json = json) } + ?: Body(_json = json) } "unit_with_percent" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingUnitWithPercentPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(unitWithPercent = it, _json = json) + } ?: Body(_json = json) } "tiered_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingTieredWithProrationPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(tieredWithProration = it, _json = json) + } ?: Body(_json = json) } "unit_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingUnitWithProrationPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(unitWithProration = it, _json = json) + } ?: Body(_json = json) } "grouped_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingGroupedAllocationPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(groupedAllocation = it, _json = json) + } ?: Body(_json = json) } "grouped_with_prorated_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(newFloatingGroupedWithProratedMinimumPrice = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Body(groupedWithProratedMinimum = it, _json = json) } + ?: Body(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(newFloatingGroupedWithMeteredMinimumPrice = it, _json = json) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Body(groupedWithMeteredMinimum = it, _json = json) } + ?: Body(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingMatrixWithDisplayNamePrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(matrixWithDisplayName = it, _json = json) + } ?: Body(_json = json) } "bulk_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingBulkWithProrationPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(bulkWithProration = it, _json = json) + } ?: Body(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingGroupedTieredPackagePrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(groupedTieredPackage = it, _json = json) + } ?: Body(_json = json) } "scalable_matrix_with_unit_pricing" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body( - newFloatingScalableMatrixWithUnitPricingPrice = it, - _json = json, - ) - } ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Body(scalableMatrixWithUnitPricing = it, _json = json) } + ?: Body(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Body( - newFloatingScalableMatrixWithTieredPricingPrice = it, - _json = json, - ) - } ?: Body(_json = json) + ?.let { Body(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Body(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(newFloatingCumulativeGroupedBulkPrice = it, _json = json) } - ?: Body(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(cumulativeGroupedBulk = it, _json = json) + } ?: Body(_json = json) } } @@ -1764,69 +1275,58 @@ private constructor( provider: SerializerProvider, ) { when { - value.newFloatingUnitPrice != null -> - generator.writeObject(value.newFloatingUnitPrice) - value.newFloatingPackagePrice != null -> - generator.writeObject(value.newFloatingPackagePrice) - value.newFloatingMatrixPrice != null -> - generator.writeObject(value.newFloatingMatrixPrice) - value.newFloatingMatrixWithAllocationPrice != null -> - generator.writeObject(value.newFloatingMatrixWithAllocationPrice) - value.newFloatingTieredPrice != null -> - generator.writeObject(value.newFloatingTieredPrice) - value.newFloatingTieredBpsPrice != null -> - generator.writeObject(value.newFloatingTieredBpsPrice) - value.newFloatingBpsPrice != null -> - generator.writeObject(value.newFloatingBpsPrice) - value.newFloatingBulkBpsPrice != null -> - generator.writeObject(value.newFloatingBulkBpsPrice) - value.newFloatingBulkPrice != null -> - generator.writeObject(value.newFloatingBulkPrice) - value.newFloatingThresholdTotalAmountPrice != null -> - generator.writeObject(value.newFloatingThresholdTotalAmountPrice) - value.newFloatingTieredPackagePrice != null -> - generator.writeObject(value.newFloatingTieredPackagePrice) - value.newFloatingGroupedTieredPrice != null -> - generator.writeObject(value.newFloatingGroupedTieredPrice) - value.newFloatingMaxGroupTieredPackagePrice != null -> - generator.writeObject(value.newFloatingMaxGroupTieredPackagePrice) - value.newFloatingTieredWithMinimumPrice != null -> - generator.writeObject(value.newFloatingTieredWithMinimumPrice) - value.newFloatingPackageWithAllocationPrice != null -> - generator.writeObject(value.newFloatingPackageWithAllocationPrice) - value.newFloatingTieredPackageWithMinimumPrice != null -> - generator.writeObject(value.newFloatingTieredPackageWithMinimumPrice) - value.newFloatingUnitWithPercentPrice != null -> - generator.writeObject(value.newFloatingUnitWithPercentPrice) - value.newFloatingTieredWithProrationPrice != null -> - generator.writeObject(value.newFloatingTieredWithProrationPrice) - value.newFloatingUnitWithProrationPrice != null -> - generator.writeObject(value.newFloatingUnitWithProrationPrice) - value.newFloatingGroupedAllocationPrice != null -> - generator.writeObject(value.newFloatingGroupedAllocationPrice) - value.newFloatingGroupedWithProratedMinimumPrice != null -> - generator.writeObject(value.newFloatingGroupedWithProratedMinimumPrice) - value.newFloatingGroupedWithMeteredMinimumPrice != null -> - generator.writeObject(value.newFloatingGroupedWithMeteredMinimumPrice) - value.newFloatingMatrixWithDisplayNamePrice != null -> - generator.writeObject(value.newFloatingMatrixWithDisplayNamePrice) - value.newFloatingBulkWithProrationPrice != null -> - generator.writeObject(value.newFloatingBulkWithProrationPrice) - value.newFloatingGroupedTieredPackagePrice != null -> - generator.writeObject(value.newFloatingGroupedTieredPackagePrice) - value.newFloatingScalableMatrixWithUnitPricingPrice != null -> - generator.writeObject(value.newFloatingScalableMatrixWithUnitPricingPrice) - value.newFloatingScalableMatrixWithTieredPricingPrice != null -> - generator.writeObject(value.newFloatingScalableMatrixWithTieredPricingPrice) - value.newFloatingCumulativeGroupedBulkPrice != null -> - generator.writeObject(value.newFloatingCumulativeGroupedBulkPrice) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.matrixWithAllocation != null -> + generator.writeObject(value.matrixWithAllocation) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.groupedTiered != null -> generator.writeObject(value.groupedTiered) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredPackageWithMinimum != null -> + generator.writeObject(value.tieredPackageWithMinimum) + value.unitWithPercent != null -> generator.writeObject(value.unitWithPercent) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Body") } } } - class NewFloatingUnitPrice + class Unit private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -2192,7 +1692,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewFloatingUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -2206,7 +1706,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -2229,23 +1729,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { - cadence = newFloatingUnitPrice.cadence - currency = newFloatingUnitPrice.currency - itemId = newFloatingUnitPrice.itemId - modelType = newFloatingUnitPrice.modelType - name = newFloatingUnitPrice.name - unitConfig = newFloatingUnitPrice.unitConfig - billableMetricId = newFloatingUnitPrice.billableMetricId - billedInAdvance = newFloatingUnitPrice.billedInAdvance - billingCycleConfiguration = newFloatingUnitPrice.billingCycleConfiguration - conversionRate = newFloatingUnitPrice.conversionRate - externalPriceId = newFloatingUnitPrice.externalPriceId - fixedPriceQuantity = newFloatingUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitPrice.invoiceGroupingKey - invoicingCycleConfiguration = newFloatingUnitPrice.invoicingCycleConfiguration - metadata = newFloatingUnitPrice.metadata - additionalProperties = newFloatingUnitPrice.additionalProperties.toMutableMap() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + currency = unit.currency + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -2581,7 +2081,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2596,8 +2096,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingUnitPrice = - NewFloatingUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -2619,7 +2119,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -3835,7 +3335,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -3845,10 +3345,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewFloatingPackagePrice + class Package private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -4214,8 +3714,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -4229,7 +3728,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -4252,25 +3751,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { - cadence = newFloatingPackagePrice.cadence - currency = newFloatingPackagePrice.currency - itemId = newFloatingPackagePrice.itemId - modelType = newFloatingPackagePrice.modelType - name = newFloatingPackagePrice.name - packageConfig = newFloatingPackagePrice.packageConfig - billableMetricId = newFloatingPackagePrice.billableMetricId - billedInAdvance = newFloatingPackagePrice.billedInAdvance - billingCycleConfiguration = newFloatingPackagePrice.billingCycleConfiguration - conversionRate = newFloatingPackagePrice.conversionRate - externalPriceId = newFloatingPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingPackagePrice.invoicingCycleConfiguration - metadata = newFloatingPackagePrice.metadata - additionalProperties = - newFloatingPackagePrice.additionalProperties.toMutableMap() + internal fun from(package_: Package) = apply { + cadence = package_.cadence + currency = package_.currency + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + additionalProperties = package_.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -4607,7 +4104,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4622,8 +4119,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingPackagePrice = - NewFloatingPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -4645,7 +4142,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -5911,7 +5408,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -5921,10 +5418,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewFloatingMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -6290,8 +5787,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -6305,7 +5801,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -6328,24 +5824,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { - cadence = newFloatingMatrixPrice.cadence - currency = newFloatingMatrixPrice.currency - itemId = newFloatingMatrixPrice.itemId - matrixConfig = newFloatingMatrixPrice.matrixConfig - modelType = newFloatingMatrixPrice.modelType - name = newFloatingMatrixPrice.name - billableMetricId = newFloatingMatrixPrice.billableMetricId - billedInAdvance = newFloatingMatrixPrice.billedInAdvance - billingCycleConfiguration = newFloatingMatrixPrice.billingCycleConfiguration - conversionRate = newFloatingMatrixPrice.conversionRate - externalPriceId = newFloatingMatrixPrice.externalPriceId - fixedPriceQuantity = newFloatingMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixPrice.invoiceGroupingKey - invoicingCycleConfiguration = newFloatingMatrixPrice.invoicingCycleConfiguration - metadata = newFloatingMatrixPrice.metadata - additionalProperties = - newFloatingMatrixPrice.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + currency = matrix.currency + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + additionalProperties = matrix.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -6682,7 +6177,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6697,8 +6192,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMatrixPrice = - NewFloatingMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -6720,7 +6215,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -8297,7 +7792,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -8307,10 +7802,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewFloatingMatrixWithAllocationPrice + class MatrixWithAllocation private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -8679,8 +8174,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingMatrixWithAllocationPrice]. + * Returns a mutable builder for constructing an instance of [MatrixWithAllocation]. * * The following fields are required: * ```java @@ -8694,7 +8188,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMatrixWithAllocationPrice]. */ + /** A builder for [MatrixWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -8718,29 +8212,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ) = apply { - cadence = newFloatingMatrixWithAllocationPrice.cadence - currency = newFloatingMatrixWithAllocationPrice.currency - itemId = newFloatingMatrixWithAllocationPrice.itemId - matrixWithAllocationConfig = - newFloatingMatrixWithAllocationPrice.matrixWithAllocationConfig - modelType = newFloatingMatrixWithAllocationPrice.modelType - name = newFloatingMatrixWithAllocationPrice.name - billableMetricId = newFloatingMatrixWithAllocationPrice.billableMetricId - billedInAdvance = newFloatingMatrixWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingMatrixWithAllocationPrice.billingCycleConfiguration - conversionRate = newFloatingMatrixWithAllocationPrice.conversionRate - externalPriceId = newFloatingMatrixWithAllocationPrice.externalPriceId - fixedPriceQuantity = newFloatingMatrixWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixWithAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingMatrixWithAllocationPrice.invoicingCycleConfiguration - metadata = newFloatingMatrixWithAllocationPrice.metadata - additionalProperties = - newFloatingMatrixWithAllocationPrice.additionalProperties.toMutableMap() + internal fun from(matrixWithAllocation: MatrixWithAllocation) = apply { + cadence = matrixWithAllocation.cadence + currency = matrixWithAllocation.currency + itemId = matrixWithAllocation.itemId + matrixWithAllocationConfig = matrixWithAllocation.matrixWithAllocationConfig + modelType = matrixWithAllocation.modelType + name = matrixWithAllocation.name + billableMetricId = matrixWithAllocation.billableMetricId + billedInAdvance = matrixWithAllocation.billedInAdvance + billingCycleConfiguration = matrixWithAllocation.billingCycleConfiguration + conversionRate = matrixWithAllocation.conversionRate + externalPriceId = matrixWithAllocation.externalPriceId + fixedPriceQuantity = matrixWithAllocation.fixedPriceQuantity + invoiceGroupingKey = matrixWithAllocation.invoiceGroupingKey + invoicingCycleConfiguration = matrixWithAllocation.invoicingCycleConfiguration + metadata = matrixWithAllocation.metadata + additionalProperties = matrixWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -9078,7 +8566,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMatrixWithAllocationPrice]. + * Returns an immutable instance of [MatrixWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9093,8 +8581,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMatrixWithAllocationPrice = - NewFloatingMatrixWithAllocationPrice( + fun build(): MatrixWithAllocation = + MatrixWithAllocation( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -9116,7 +8604,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMatrixWithAllocationPrice = apply { + fun validate(): MatrixWithAllocation = apply { if (validated) { return@apply } @@ -10742,7 +10230,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is MatrixWithAllocation && 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 */ @@ -10752,10 +10240,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "MatrixWithAllocation{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}" } - class NewFloatingTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -11121,8 +10609,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -11136,7 +10623,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -11159,24 +10646,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { - cadence = newFloatingTieredPrice.cadence - currency = newFloatingTieredPrice.currency - itemId = newFloatingTieredPrice.itemId - modelType = newFloatingTieredPrice.modelType - name = newFloatingTieredPrice.name - tieredConfig = newFloatingTieredPrice.tieredConfig - billableMetricId = newFloatingTieredPrice.billableMetricId - billedInAdvance = newFloatingTieredPrice.billedInAdvance - billingCycleConfiguration = newFloatingTieredPrice.billingCycleConfiguration - conversionRate = newFloatingTieredPrice.conversionRate - externalPriceId = newFloatingTieredPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPrice.invoiceGroupingKey - invoicingCycleConfiguration = newFloatingTieredPrice.invoicingCycleConfiguration - metadata = newFloatingTieredPrice.metadata - additionalProperties = - newFloatingTieredPrice.additionalProperties.toMutableMap() + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + currency = tiered.currency + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + additionalProperties = tiered.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -11513,7 +10999,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11528,8 +11014,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredPrice = - NewFloatingTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -11551,7 +11037,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -13047,7 +12533,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -13057,10 +12543,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewFloatingTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -13427,8 +12913,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -13442,7 +12927,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -13465,25 +12950,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = apply { - cadence = newFloatingTieredBpsPrice.cadence - currency = newFloatingTieredBpsPrice.currency - itemId = newFloatingTieredBpsPrice.itemId - modelType = newFloatingTieredBpsPrice.modelType - name = newFloatingTieredBpsPrice.name - tieredBpsConfig = newFloatingTieredBpsPrice.tieredBpsConfig - billableMetricId = newFloatingTieredBpsPrice.billableMetricId - billedInAdvance = newFloatingTieredBpsPrice.billedInAdvance - billingCycleConfiguration = newFloatingTieredBpsPrice.billingCycleConfiguration - conversionRate = newFloatingTieredBpsPrice.conversionRate - externalPriceId = newFloatingTieredBpsPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredBpsPrice.invoicingCycleConfiguration - metadata = newFloatingTieredBpsPrice.metadata - additionalProperties = - newFloatingTieredBpsPrice.additionalProperties.toMutableMap() + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + currency = tieredBps.currency + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + additionalProperties = tieredBps.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -13820,7 +13303,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -13835,8 +13318,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredBpsPrice = - NewFloatingTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -13858,7 +13341,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -15402,7 +14885,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -15412,10 +14895,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewFloatingBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -15781,7 +15264,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewFloatingBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -15795,7 +15278,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -15818,23 +15301,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { - bpsConfig = newFloatingBpsPrice.bpsConfig - cadence = newFloatingBpsPrice.cadence - currency = newFloatingBpsPrice.currency - itemId = newFloatingBpsPrice.itemId - modelType = newFloatingBpsPrice.modelType - name = newFloatingBpsPrice.name - billableMetricId = newFloatingBpsPrice.billableMetricId - billedInAdvance = newFloatingBpsPrice.billedInAdvance - billingCycleConfiguration = newFloatingBpsPrice.billingCycleConfiguration - conversionRate = newFloatingBpsPrice.conversionRate - externalPriceId = newFloatingBpsPrice.externalPriceId - fixedPriceQuantity = newFloatingBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = newFloatingBpsPrice.invoicingCycleConfiguration - metadata = newFloatingBpsPrice.metadata - additionalProperties = newFloatingBpsPrice.additionalProperties.toMutableMap() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + currency = bps.currency + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -16170,7 +15653,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -16185,8 +15668,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBpsPrice = - NewFloatingBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -16208,7 +15691,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -17468,7 +16951,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -17478,10 +16961,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewFloatingBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -17847,8 +17330,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -17862,7 +17344,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -17885,25 +17367,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { - bulkBpsConfig = newFloatingBulkBpsPrice.bulkBpsConfig - cadence = newFloatingBulkBpsPrice.cadence - currency = newFloatingBulkBpsPrice.currency - itemId = newFloatingBulkBpsPrice.itemId - modelType = newFloatingBulkBpsPrice.modelType - name = newFloatingBulkBpsPrice.name - billableMetricId = newFloatingBulkBpsPrice.billableMetricId - billedInAdvance = newFloatingBulkBpsPrice.billedInAdvance - billingCycleConfiguration = newFloatingBulkBpsPrice.billingCycleConfiguration - conversionRate = newFloatingBulkBpsPrice.conversionRate - externalPriceId = newFloatingBulkBpsPrice.externalPriceId - fixedPriceQuantity = newFloatingBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingBulkBpsPrice.invoicingCycleConfiguration - metadata = newFloatingBulkBpsPrice.metadata - additionalProperties = - newFloatingBulkBpsPrice.additionalProperties.toMutableMap() + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + currency = bulkBps.currency + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + additionalProperties = bulkBps.additionalProperties.toMutableMap() } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = @@ -18240,7 +17720,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -18255,8 +17735,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBulkBpsPrice = - NewFloatingBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -18278,7 +17758,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -19777,7 +19257,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -19787,10 +19267,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewFloatingBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -20156,7 +19636,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewFloatingBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -20170,7 +19650,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -20193,23 +19673,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { - bulkConfig = newFloatingBulkPrice.bulkConfig - cadence = newFloatingBulkPrice.cadence - currency = newFloatingBulkPrice.currency - itemId = newFloatingBulkPrice.itemId - modelType = newFloatingBulkPrice.modelType - name = newFloatingBulkPrice.name - billableMetricId = newFloatingBulkPrice.billableMetricId - billedInAdvance = newFloatingBulkPrice.billedInAdvance - billingCycleConfiguration = newFloatingBulkPrice.billingCycleConfiguration - conversionRate = newFloatingBulkPrice.conversionRate - externalPriceId = newFloatingBulkPrice.externalPriceId - fixedPriceQuantity = newFloatingBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkPrice.invoiceGroupingKey - invoicingCycleConfiguration = newFloatingBulkPrice.invoicingCycleConfiguration - metadata = newFloatingBulkPrice.metadata - additionalProperties = newFloatingBulkPrice.additionalProperties.toMutableMap() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + currency = bulk.currency + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -20545,7 +20025,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -20560,8 +20040,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBulkPrice = - NewFloatingBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -20583,7 +20063,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -22039,7 +21519,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -22049,10 +21529,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewFloatingThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -22421,8 +21901,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingThresholdTotalAmountPrice]. + * Returns a mutable builder for constructing an instance of [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -22436,7 +21915,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -22460,29 +21939,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ) = apply { - cadence = newFloatingThresholdTotalAmountPrice.cadence - currency = newFloatingThresholdTotalAmountPrice.currency - itemId = newFloatingThresholdTotalAmountPrice.itemId - modelType = newFloatingThresholdTotalAmountPrice.modelType - name = newFloatingThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newFloatingThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newFloatingThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newFloatingThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newFloatingThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newFloatingThresholdTotalAmountPrice.conversionRate - externalPriceId = newFloatingThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = newFloatingThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingThresholdTotalAmountPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newFloatingThresholdTotalAmountPrice.metadata - additionalProperties = - newFloatingThresholdTotalAmountPrice.additionalProperties.toMutableMap() + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + currency = thresholdTotalAmount.currency + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey + invoicingCycleConfiguration = thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata + additionalProperties = thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -22820,7 +22293,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -22835,8 +22308,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingThresholdTotalAmountPrice = - NewFloatingThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -22858,7 +22331,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -24017,7 +23490,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -24027,10 +23500,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewFloatingTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -24397,8 +23870,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -24412,7 +23884,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -24435,28 +23907,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice) = - apply { - cadence = newFloatingTieredPackagePrice.cadence - currency = newFloatingTieredPackagePrice.currency - itemId = newFloatingTieredPackagePrice.itemId - modelType = newFloatingTieredPackagePrice.modelType - name = newFloatingTieredPackagePrice.name - tieredPackageConfig = newFloatingTieredPackagePrice.tieredPackageConfig - billableMetricId = newFloatingTieredPackagePrice.billableMetricId - billedInAdvance = newFloatingTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredPackagePrice.billingCycleConfiguration - conversionRate = newFloatingTieredPackagePrice.conversionRate - externalPriceId = newFloatingTieredPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredPackagePrice.invoicingCycleConfiguration - metadata = newFloatingTieredPackagePrice.metadata - additionalProperties = - newFloatingTieredPackagePrice.additionalProperties.toMutableMap() - } + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + currency = tieredPackage.currency + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + additionalProperties = tieredPackage.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -24793,7 +24261,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -24808,8 +24276,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredPackagePrice = - NewFloatingTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -24831,7 +24299,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -25989,7 +25457,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -25999,10 +25467,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewFloatingGroupedTieredPrice + class GroupedTiered private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -26369,8 +25837,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedTieredPrice]. + * Returns a mutable builder for constructing an instance of [GroupedTiered]. * * The following fields are required: * ```java @@ -26384,7 +25851,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedTieredPrice]. */ + /** A builder for [GroupedTiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -26407,28 +25874,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice) = - apply { - cadence = newFloatingGroupedTieredPrice.cadence - currency = newFloatingGroupedTieredPrice.currency - groupedTieredConfig = newFloatingGroupedTieredPrice.groupedTieredConfig - itemId = newFloatingGroupedTieredPrice.itemId - modelType = newFloatingGroupedTieredPrice.modelType - name = newFloatingGroupedTieredPrice.name - billableMetricId = newFloatingGroupedTieredPrice.billableMetricId - billedInAdvance = newFloatingGroupedTieredPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedTieredPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedTieredPrice.conversionRate - externalPriceId = newFloatingGroupedTieredPrice.externalPriceId - fixedPriceQuantity = newFloatingGroupedTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedTieredPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedTieredPrice.metadata - additionalProperties = - newFloatingGroupedTieredPrice.additionalProperties.toMutableMap() - } + internal fun from(groupedTiered: GroupedTiered) = apply { + cadence = groupedTiered.cadence + currency = groupedTiered.currency + groupedTieredConfig = groupedTiered.groupedTieredConfig + itemId = groupedTiered.itemId + modelType = groupedTiered.modelType + name = groupedTiered.name + billableMetricId = groupedTiered.billableMetricId + billedInAdvance = groupedTiered.billedInAdvance + billingCycleConfiguration = groupedTiered.billingCycleConfiguration + conversionRate = groupedTiered.conversionRate + externalPriceId = groupedTiered.externalPriceId + fixedPriceQuantity = groupedTiered.fixedPriceQuantity + invoiceGroupingKey = groupedTiered.invoiceGroupingKey + invoicingCycleConfiguration = groupedTiered.invoicingCycleConfiguration + metadata = groupedTiered.metadata + additionalProperties = groupedTiered.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -26765,7 +26228,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedTieredPrice]. + * Returns an immutable instance of [GroupedTiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -26780,8 +26243,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedTieredPrice = - NewFloatingGroupedTieredPrice( + fun build(): GroupedTiered = + GroupedTiered( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("groupedTieredConfig", groupedTieredConfig), @@ -26803,7 +26266,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedTieredPrice = apply { + fun validate(): GroupedTiered = apply { if (validated) { return@apply } @@ -27961,7 +27424,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedTiered && 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 */ @@ -27971,10 +27434,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedTiered{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}" } - class NewFloatingMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -28344,7 +27807,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -28358,7 +27821,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -28382,29 +27845,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ) = apply { - cadence = newFloatingMaxGroupTieredPackagePrice.cadence - currency = newFloatingMaxGroupTieredPackagePrice.currency - itemId = newFloatingMaxGroupTieredPackagePrice.itemId - maxGroupTieredPackageConfig = - newFloatingMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newFloatingMaxGroupTieredPackagePrice.modelType - name = newFloatingMaxGroupTieredPackagePrice.name - billableMetricId = newFloatingMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newFloatingMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newFloatingMaxGroupTieredPackagePrice.conversionRate - externalPriceId = newFloatingMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMaxGroupTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newFloatingMaxGroupTieredPackagePrice.metadata - additionalProperties = - newFloatingMaxGroupTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + currency = maxGroupTieredPackage.currency + itemId = maxGroupTieredPackage.itemId + maxGroupTieredPackageConfig = maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata + additionalProperties = maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -28742,7 +28199,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -28757,8 +28214,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMaxGroupTieredPackagePrice = - NewFloatingMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -28780,7 +28237,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -29941,7 +29398,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingMaxGroupTieredPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && currency == other.currency && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -29951,10 +29408,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMaxGroupTieredPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "MaxGroupTieredPackage{cadence=$cadence, currency=$currency, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewFloatingTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -30322,8 +29779,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredWithMinimumPrice]. + * Returns a mutable builder for constructing an instance of [TieredWithMinimum]. * * The following fields are required: * ```java @@ -30337,7 +29793,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -30360,29 +29816,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) = apply { - cadence = newFloatingTieredWithMinimumPrice.cadence - currency = newFloatingTieredWithMinimumPrice.currency - itemId = newFloatingTieredWithMinimumPrice.itemId - modelType = newFloatingTieredWithMinimumPrice.modelType - name = newFloatingTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newFloatingTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newFloatingTieredWithMinimumPrice.billableMetricId - billedInAdvance = newFloatingTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingTieredWithMinimumPrice.conversionRate - externalPriceId = newFloatingTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingTieredWithMinimumPrice.metadata - additionalProperties = - newFloatingTieredWithMinimumPrice.additionalProperties.toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + currency = tieredWithMinimum.currency + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -30719,7 +30169,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -30734,8 +30184,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredWithMinimumPrice = - NewFloatingTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -30757,7 +30207,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -31915,7 +31365,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -31925,10 +31375,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewFloatingPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -32298,7 +31748,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -32312,7 +31762,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -32336,29 +31786,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ) = apply { - cadence = newFloatingPackageWithAllocationPrice.cadence - currency = newFloatingPackageWithAllocationPrice.currency - itemId = newFloatingPackageWithAllocationPrice.itemId - modelType = newFloatingPackageWithAllocationPrice.modelType - name = newFloatingPackageWithAllocationPrice.name - packageWithAllocationConfig = - newFloatingPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = newFloatingPackageWithAllocationPrice.billableMetricId - billedInAdvance = newFloatingPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newFloatingPackageWithAllocationPrice.conversionRate - externalPriceId = newFloatingPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = newFloatingPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingPackageWithAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newFloatingPackageWithAllocationPrice.metadata - additionalProperties = - newFloatingPackageWithAllocationPrice.additionalProperties.toMutableMap() + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + currency = packageWithAllocation.currency + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name + packageWithAllocationConfig = packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey + invoicingCycleConfiguration = packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata + additionalProperties = packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -32696,7 +32140,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -32711,8 +32155,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingPackageWithAllocationPrice = - NewFloatingPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -32734,7 +32178,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -33895,7 +33339,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -33905,10 +33349,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewFloatingTieredPackageWithMinimumPrice + class TieredPackageWithMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -34278,7 +33722,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredPackageWithMinimumPrice]. + * [TieredPackageWithMinimum]. * * The following fields are required: * ```java @@ -34292,7 +33736,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredPackageWithMinimumPrice]. */ + /** A builder for [TieredPackageWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -34317,30 +33761,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredPackageWithMinimumPrice: - NewFloatingTieredPackageWithMinimumPrice - ) = apply { - cadence = newFloatingTieredPackageWithMinimumPrice.cadence - currency = newFloatingTieredPackageWithMinimumPrice.currency - itemId = newFloatingTieredPackageWithMinimumPrice.itemId - modelType = newFloatingTieredPackageWithMinimumPrice.modelType - name = newFloatingTieredPackageWithMinimumPrice.name + internal fun from(tieredPackageWithMinimum: TieredPackageWithMinimum) = apply { + cadence = tieredPackageWithMinimum.cadence + currency = tieredPackageWithMinimum.currency + itemId = tieredPackageWithMinimum.itemId + modelType = tieredPackageWithMinimum.modelType + name = tieredPackageWithMinimum.name tieredPackageWithMinimumConfig = - newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig - billableMetricId = newFloatingTieredPackageWithMinimumPrice.billableMetricId - billedInAdvance = newFloatingTieredPackageWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate - externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredPackageWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackageWithMinimumPrice.invoiceGroupingKey + tieredPackageWithMinimum.tieredPackageWithMinimumConfig + billableMetricId = tieredPackageWithMinimum.billableMetricId + billedInAdvance = tieredPackageWithMinimum.billedInAdvance + billingCycleConfiguration = tieredPackageWithMinimum.billingCycleConfiguration + conversionRate = tieredPackageWithMinimum.conversionRate + externalPriceId = tieredPackageWithMinimum.externalPriceId + fixedPriceQuantity = tieredPackageWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredPackageWithMinimum.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingTieredPackageWithMinimumPrice.metadata + tieredPackageWithMinimum.invoicingCycleConfiguration + metadata = tieredPackageWithMinimum.metadata additionalProperties = - newFloatingTieredPackageWithMinimumPrice.additionalProperties.toMutableMap() + tieredPackageWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -34678,7 +34118,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredPackageWithMinimumPrice]. + * Returns an immutable instance of [TieredPackageWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -34693,8 +34133,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredPackageWithMinimumPrice = - NewFloatingTieredPackageWithMinimumPrice( + fun build(): TieredPackageWithMinimum = + TieredPackageWithMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -34719,7 +34159,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredPackageWithMinimumPrice = apply { + fun validate(): TieredPackageWithMinimum = apply { if (validated) { return@apply } @@ -35881,7 +35321,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackageWithMinimum && 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 */ @@ -35891,10 +35331,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackageWithMinimum{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}" } - class NewFloatingUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -36261,8 +35701,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -36276,7 +35715,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -36299,28 +35738,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) = apply { - cadence = newFloatingUnitWithPercentPrice.cadence - currency = newFloatingUnitWithPercentPrice.currency - itemId = newFloatingUnitWithPercentPrice.itemId - modelType = newFloatingUnitWithPercentPrice.modelType - name = newFloatingUnitWithPercentPrice.name - unitWithPercentConfig = newFloatingUnitWithPercentPrice.unitWithPercentConfig - billableMetricId = newFloatingUnitWithPercentPrice.billableMetricId - billedInAdvance = newFloatingUnitWithPercentPrice.billedInAdvance - billingCycleConfiguration = - newFloatingUnitWithPercentPrice.billingCycleConfiguration - conversionRate = newFloatingUnitWithPercentPrice.conversionRate - externalPriceId = newFloatingUnitWithPercentPrice.externalPriceId - fixedPriceQuantity = newFloatingUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithPercentPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingUnitWithPercentPrice.invoicingCycleConfiguration - metadata = newFloatingUnitWithPercentPrice.metadata - additionalProperties = - newFloatingUnitWithPercentPrice.additionalProperties.toMutableMap() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + currency = unitWithPercent.currency + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -36658,7 +36092,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -36673,8 +36107,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingUnitWithPercentPrice = - NewFloatingUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -36696,7 +36130,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -37854,7 +37288,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -37864,10 +37298,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewFloatingTieredWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -38235,8 +37669,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [TieredWithProration]. * * The following fields are required: * ```java @@ -38250,7 +37683,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -38273,29 +37706,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ) = apply { - cadence = newFloatingTieredWithProrationPrice.cadence - currency = newFloatingTieredWithProrationPrice.currency - itemId = newFloatingTieredWithProrationPrice.itemId - modelType = newFloatingTieredWithProrationPrice.modelType - name = newFloatingTieredWithProrationPrice.name - tieredWithProrationConfig = - newFloatingTieredWithProrationPrice.tieredWithProrationConfig - billableMetricId = newFloatingTieredWithProrationPrice.billableMetricId - billedInAdvance = newFloatingTieredWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredWithProrationPrice.billingCycleConfiguration - conversionRate = newFloatingTieredWithProrationPrice.conversionRate - externalPriceId = newFloatingTieredWithProrationPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredWithProrationPrice.invoicingCycleConfiguration - metadata = newFloatingTieredWithProrationPrice.metadata - additionalProperties = - newFloatingTieredWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + currency = tieredWithProration.currency + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata + additionalProperties = tieredWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -38633,7 +38060,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -38648,8 +38075,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredWithProrationPrice = - NewFloatingTieredWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -38671,7 +38098,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -39830,7 +39257,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -39840,10 +39267,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewFloatingUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -40211,8 +39638,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingUnitWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithProration]. * * The following fields are required: * ```java @@ -40226,7 +39652,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -40249,29 +39675,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) = apply { - cadence = newFloatingUnitWithProrationPrice.cadence - currency = newFloatingUnitWithProrationPrice.currency - itemId = newFloatingUnitWithProrationPrice.itemId - modelType = newFloatingUnitWithProrationPrice.modelType - name = newFloatingUnitWithProrationPrice.name - unitWithProrationConfig = - newFloatingUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newFloatingUnitWithProrationPrice.billableMetricId - billedInAdvance = newFloatingUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newFloatingUnitWithProrationPrice.conversionRate - externalPriceId = newFloatingUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = newFloatingUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newFloatingUnitWithProrationPrice.metadata - additionalProperties = - newFloatingUnitWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + currency = unitWithProration.currency + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -40608,7 +40028,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -40623,8 +40043,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingUnitWithProrationPrice = - NewFloatingUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -40646,7 +40066,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -41804,7 +41224,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -41814,10 +41234,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewFloatingGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -42185,8 +41605,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedAllocationPrice]. + * Returns a mutable builder for constructing an instance of [GroupedAllocation]. * * The following fields are required: * ```java @@ -42200,7 +41619,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -42223,29 +41642,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) = apply { - cadence = newFloatingGroupedAllocationPrice.cadence - currency = newFloatingGroupedAllocationPrice.currency - groupedAllocationConfig = - newFloatingGroupedAllocationPrice.groupedAllocationConfig - itemId = newFloatingGroupedAllocationPrice.itemId - modelType = newFloatingGroupedAllocationPrice.modelType - name = newFloatingGroupedAllocationPrice.name - billableMetricId = newFloatingGroupedAllocationPrice.billableMetricId - billedInAdvance = newFloatingGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedAllocationPrice.conversionRate - externalPriceId = newFloatingGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = newFloatingGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedAllocationPrice.metadata - additionalProperties = - newFloatingGroupedAllocationPrice.additionalProperties.toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + currency = groupedAllocation.currency + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -42582,7 +41995,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -42597,8 +42010,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedAllocationPrice = - NewFloatingGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("groupedAllocationConfig", groupedAllocationConfig), @@ -42620,7 +42033,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -43778,7 +43191,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -43788,10 +43201,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewFloatingGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -44162,7 +43575,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -44176,7 +43589,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -44201,33 +43614,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice - ) = apply { - cadence = newFloatingGroupedWithProratedMinimumPrice.cadence - currency = newFloatingGroupedWithProratedMinimumPrice.currency + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = apply { + cadence = groupedWithProratedMinimum.cadence + currency = groupedWithProratedMinimum.currency groupedWithProratedMinimumConfig = - newFloatingGroupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig - itemId = newFloatingGroupedWithProratedMinimumPrice.itemId - modelType = newFloatingGroupedWithProratedMinimumPrice.modelType - name = newFloatingGroupedWithProratedMinimumPrice.name - billableMetricId = newFloatingGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = newFloatingGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedWithProratedMinimumPrice.conversionRate - externalPriceId = newFloatingGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = - newFloatingGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingGroupedWithProratedMinimumPrice.invoiceGroupingKey + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingGroupedWithProratedMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedWithProratedMinimumPrice.metadata + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata additionalProperties = - newFloatingGroupedWithProratedMinimumPrice.additionalProperties - .toMutableMap() + groupedWithProratedMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -44567,7 +43973,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -44582,8 +43988,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedWithProratedMinimumPrice = - NewFloatingGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired( @@ -44608,7 +44014,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -45770,7 +45176,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -45780,10 +45186,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewFloatingGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -46153,7 +45559,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -46167,7 +45573,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -46192,33 +45598,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newFloatingGroupedWithMeteredMinimumPrice.cadence - currency = newFloatingGroupedWithMeteredMinimumPrice.currency + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = apply { + cadence = groupedWithMeteredMinimum.cadence + currency = groupedWithMeteredMinimum.currency groupedWithMeteredMinimumConfig = - newFloatingGroupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig - itemId = newFloatingGroupedWithMeteredMinimumPrice.itemId - modelType = newFloatingGroupedWithMeteredMinimumPrice.modelType - name = newFloatingGroupedWithMeteredMinimumPrice.name - billableMetricId = newFloatingGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = newFloatingGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedWithMeteredMinimumPrice.conversionRate - externalPriceId = newFloatingGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = - newFloatingGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingGroupedWithMeteredMinimumPrice.invoiceGroupingKey + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedWithMeteredMinimumPrice.metadata + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata additionalProperties = - newFloatingGroupedWithMeteredMinimumPrice.additionalProperties - .toMutableMap() + groupedWithMeteredMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -46556,7 +45955,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -46571,8 +45970,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedWithMeteredMinimumPrice = - NewFloatingGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired( @@ -46597,7 +45996,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -47759,7 +47158,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 */ @@ -47769,10 +47168,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithMeteredMinimum{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}" } - class NewFloatingMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -48142,7 +47541,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -48156,7 +47555,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -48180,29 +47579,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ) = apply { - cadence = newFloatingMatrixWithDisplayNamePrice.cadence - currency = newFloatingMatrixWithDisplayNamePrice.currency - itemId = newFloatingMatrixWithDisplayNamePrice.itemId - matrixWithDisplayNameConfig = - newFloatingMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newFloatingMatrixWithDisplayNamePrice.modelType - name = newFloatingMatrixWithDisplayNamePrice.name - billableMetricId = newFloatingMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newFloatingMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newFloatingMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newFloatingMatrixWithDisplayNamePrice.conversionRate - externalPriceId = newFloatingMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = newFloatingMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixWithDisplayNamePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newFloatingMatrixWithDisplayNamePrice.metadata - additionalProperties = - newFloatingMatrixWithDisplayNamePrice.additionalProperties.toMutableMap() + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + currency = matrixWithDisplayName.currency + itemId = matrixWithDisplayName.itemId + matrixWithDisplayNameConfig = matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey + invoicingCycleConfiguration = matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata + additionalProperties = matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -48540,7 +47933,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -48555,8 +47948,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMatrixWithDisplayNamePrice = - NewFloatingMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -48578,7 +47971,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -49739,7 +49132,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 */ @@ -49749,10 +49142,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "MatrixWithDisplayName{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}" } - class NewFloatingBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -50120,8 +49513,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingBulkWithProrationPrice]. + * Returns a mutable builder for constructing an instance of [BulkWithProration]. * * The following fields are required: * ```java @@ -50135,7 +49527,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -50158,29 +49550,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) = apply { - bulkWithProrationConfig = - newFloatingBulkWithProrationPrice.bulkWithProrationConfig - cadence = newFloatingBulkWithProrationPrice.cadence - currency = newFloatingBulkWithProrationPrice.currency - itemId = newFloatingBulkWithProrationPrice.itemId - modelType = newFloatingBulkWithProrationPrice.modelType - name = newFloatingBulkWithProrationPrice.name - billableMetricId = newFloatingBulkWithProrationPrice.billableMetricId - billedInAdvance = newFloatingBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newFloatingBulkWithProrationPrice.conversionRate - externalPriceId = newFloatingBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = newFloatingBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newFloatingBulkWithProrationPrice.metadata - additionalProperties = - newFloatingBulkWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + currency = bulkWithProration.currency + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = @@ -50517,7 +49903,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -50532,8 +49918,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBulkWithProrationPrice = - NewFloatingBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -50555,7 +49941,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -51713,7 +51099,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -51723,10 +51109,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewFloatingGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -52095,8 +51481,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -52110,7 +51495,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -52134,29 +51519,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ) = apply { - cadence = newFloatingGroupedTieredPackagePrice.cadence - currency = newFloatingGroupedTieredPackagePrice.currency - groupedTieredPackageConfig = - newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newFloatingGroupedTieredPackagePrice.itemId - modelType = newFloatingGroupedTieredPackagePrice.modelType - name = newFloatingGroupedTieredPackagePrice.name - billableMetricId = newFloatingGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newFloatingGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate - externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newFloatingGroupedTieredPackagePrice.metadata - additionalProperties = - newFloatingGroupedTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + currency = groupedTieredPackage.currency + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata + additionalProperties = groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -52494,7 +51873,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -52509,8 +51888,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedTieredPackagePrice = - NewFloatingGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), @@ -52532,7 +51911,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -53691,7 +53070,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedTieredPackage && 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 */ @@ -53701,10 +53080,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedTieredPackage{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}" } - class NewFloatingScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -54078,7 +53457,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -54092,7 +53471,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -54118,36 +53497,29 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice - ) = apply { - cadence = newFloatingScalableMatrixWithUnitPricingPrice.cadence - currency = newFloatingScalableMatrixWithUnitPricingPrice.currency - itemId = newFloatingScalableMatrixWithUnitPricingPrice.itemId - modelType = newFloatingScalableMatrixWithUnitPricingPrice.modelType - name = newFloatingScalableMatrixWithUnitPricingPrice.name - scalableMatrixWithUnitPricingConfig = - newFloatingScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = - newFloatingScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = newFloatingScalableMatrixWithUnitPricingPrice.billedInAdvance - billingCycleConfiguration = - newFloatingScalableMatrixWithUnitPricingPrice.billingCycleConfiguration - conversionRate = newFloatingScalableMatrixWithUnitPricingPrice.conversionRate - externalPriceId = newFloatingScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newFloatingScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingScalableMatrixWithUnitPricingPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingScalableMatrixWithUnitPricingPrice.invoicingCycleConfiguration - metadata = newFloatingScalableMatrixWithUnitPricingPrice.metadata - additionalProperties = - newFloatingScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() - } + internal fun from(scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing) = + apply { + cadence = scalableMatrixWithUnitPricing.cadence + currency = scalableMatrixWithUnitPricing.currency + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name + scalableMatrixWithUnitPricingConfig = + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance + billingCycleConfiguration = + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey + invoicingCycleConfiguration = + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata + additionalProperties = + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -54490,7 +53862,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -54505,8 +53877,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingScalableMatrixWithUnitPricingPrice = - NewFloatingScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -54531,7 +53903,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -55693,7 +55065,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingScalableMatrixWithUnitPricingPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -55703,10 +55075,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingScalableMatrixWithUnitPricingPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewFloatingScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -56081,7 +55453,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -56095,7 +55467,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -56122,36 +55494,28 @@ private constructor( @JvmSynthetic internal fun from( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newFloatingScalableMatrixWithTieredPricingPrice.cadence - currency = newFloatingScalableMatrixWithTieredPricingPrice.currency - itemId = newFloatingScalableMatrixWithTieredPricingPrice.itemId - modelType = newFloatingScalableMatrixWithTieredPricingPrice.modelType - name = newFloatingScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + currency = scalableMatrixWithTieredPricing.currency + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newFloatingScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = - newFloatingScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = - newFloatingScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newFloatingScalableMatrixWithTieredPricingPrice.billingCycleConfiguration - conversionRate = newFloatingScalableMatrixWithTieredPricingPrice.conversionRate - externalPriceId = - newFloatingScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newFloatingScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingScalableMatrixWithTieredPricingPrice.invoicingCycleConfiguration - metadata = newFloatingScalableMatrixWithTieredPricingPrice.metadata + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata additionalProperties = - newFloatingScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -56496,8 +55860,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewFloatingScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -56512,8 +55875,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingScalableMatrixWithTieredPricingPrice = - NewFloatingScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -56538,7 +55901,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -57701,7 +57064,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingScalableMatrixWithTieredPricingPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -57711,10 +57074,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingScalableMatrixWithTieredPricingPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewFloatingCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -58084,7 +57447,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -58098,7 +57461,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -58122,29 +57485,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ) = apply { - cadence = newFloatingCumulativeGroupedBulkPrice.cadence - cumulativeGroupedBulkConfig = - newFloatingCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - currency = newFloatingCumulativeGroupedBulkPrice.currency - itemId = newFloatingCumulativeGroupedBulkPrice.itemId - modelType = newFloatingCumulativeGroupedBulkPrice.modelType - name = newFloatingCumulativeGroupedBulkPrice.name - billableMetricId = newFloatingCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newFloatingCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newFloatingCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newFloatingCumulativeGroupedBulkPrice.conversionRate - externalPriceId = newFloatingCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = newFloatingCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingCumulativeGroupedBulkPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newFloatingCumulativeGroupedBulkPrice.metadata - additionalProperties = - newFloatingCumulativeGroupedBulkPrice.additionalProperties.toMutableMap() + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence + cumulativeGroupedBulkConfig = cumulativeGroupedBulk.cumulativeGroupedBulkConfig + currency = cumulativeGroupedBulk.currency + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey + invoicingCycleConfiguration = cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata + additionalProperties = cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -58482,7 +57839,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -58497,8 +57854,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingCumulativeGroupedBulkPrice = - NewFloatingCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired("cumulativeGroupedBulkConfig", cumulativeGroupedBulkConfig), checkRequired("currency", currency), @@ -58520,7 +57877,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -59681,7 +59038,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -59691,7 +59048,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageResponse.kt index 6d09727c0..71723f6c9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListPageResponse.kt @@ -129,136 +129,136 @@ private constructor( } /** Alias for calling [addData] with `Price.ofUnit(unit)`. */ - fun addData(unit: Price.UnitPrice) = addData(Price.ofUnit(unit)) + fun addData(unit: Price.Unit) = addData(Price.ofUnit(unit)) - /** Alias for calling [addData] with `Price.ofPackagePrice(packagePrice)`. */ - fun addData(packagePrice: Price.PackagePrice) = addData(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [addData] with `Price.ofPackage(package_)`. */ + fun addData(package_: Price.Package) = addData(Price.ofPackage(package_)) /** Alias for calling [addData] with `Price.ofMatrix(matrix)`. */ - fun addData(matrix: Price.MatrixPrice) = addData(Price.ofMatrix(matrix)) + fun addData(matrix: Price.Matrix) = addData(Price.ofMatrix(matrix)) /** Alias for calling [addData] with `Price.ofTiered(tiered)`. */ - fun addData(tiered: Price.TieredPrice) = addData(Price.ofTiered(tiered)) + fun addData(tiered: Price.Tiered) = addData(Price.ofTiered(tiered)) /** Alias for calling [addData] with `Price.ofTieredBps(tieredBps)`. */ - fun addData(tieredBps: Price.TieredBpsPrice) = addData(Price.ofTieredBps(tieredBps)) + fun addData(tieredBps: Price.TieredBps) = addData(Price.ofTieredBps(tieredBps)) /** Alias for calling [addData] with `Price.ofBps(bps)`. */ - fun addData(bps: Price.BpsPrice) = addData(Price.ofBps(bps)) + fun addData(bps: Price.Bps) = addData(Price.ofBps(bps)) /** Alias for calling [addData] with `Price.ofBulkBps(bulkBps)`. */ - fun addData(bulkBps: Price.BulkBpsPrice) = addData(Price.ofBulkBps(bulkBps)) + fun addData(bulkBps: Price.BulkBps) = addData(Price.ofBulkBps(bulkBps)) /** Alias for calling [addData] with `Price.ofBulk(bulk)`. */ - fun addData(bulk: Price.BulkPrice) = addData(Price.ofBulk(bulk)) + fun addData(bulk: Price.Bulk) = addData(Price.ofBulk(bulk)) /** * Alias for calling [addData] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun addData(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun addData(thresholdTotalAmount: Price.ThresholdTotalAmount) = addData(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [addData] with `Price.ofTieredPackage(tieredPackage)`. */ - fun addData(tieredPackage: Price.TieredPackagePrice) = + fun addData(tieredPackage: Price.TieredPackage) = addData(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [addData] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun addData(groupedTiered: Price.GroupedTieredPrice) = + fun addData(groupedTiered: Price.GroupedTiered) = addData(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [addData] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun addData(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun addData(tieredWithMinimum: Price.TieredWithMinimum) = addData(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [addData] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun addData(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun addData(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = addData(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [addData] with `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun addData(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun addData(packageWithAllocation: Price.PackageWithAllocation) = addData(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [addData] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun addData(unitWithPercent: Price.UnitWithPercentPrice) = + fun addData(unitWithPercent: Price.UnitWithPercent) = addData(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [addData] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun addData(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun addData(matrixWithAllocation: Price.MatrixWithAllocation) = addData(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** Alias for calling [addData] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun addData(tieredWithProration: Price.TieredWithProrationPrice) = + fun addData(tieredWithProration: Price.TieredWithProration) = addData(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [addData] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun addData(unitWithProration: Price.UnitWithProrationPrice) = + fun addData(unitWithProration: Price.UnitWithProration) = addData(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [addData] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun addData(groupedAllocation: Price.GroupedAllocationPrice) = + fun addData(groupedAllocation: Price.GroupedAllocation) = addData(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [addData] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun addData(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun addData(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = addData(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [addData] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun addData(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun addData(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = addData(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [addData] with `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun addData(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun addData(matrixWithDisplayName: Price.MatrixWithDisplayName) = addData(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [addData] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun addData(bulkWithProration: Price.BulkWithProrationPrice) = + fun addData(bulkWithProration: Price.BulkWithProration) = addData(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [addData] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun addData(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun addData(groupedTieredPackage: Price.GroupedTieredPackage) = addData(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [addData] with `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun addData(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun addData(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = addData(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [addData] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun addData(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun addData(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = addData(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [addData] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun addData(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun addData(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = addData(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [addData] with `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun addData(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun addData(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = addData(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) fun paginationMetadata(paginationMetadata: PaginationMetadata) = 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 c8f173aa9..1d210e999 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 @@ -1040,17 +1040,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1668,41 +1668,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1851,66 +1838,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1923,34 +1900,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -1975,25 +1944,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2004,21 +1967,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2026,27 +1987,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2055,21 +2009,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2095,44 +2043,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2148,23 +2081,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2345,8 +2274,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2361,7 +2289,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2374,21 +2302,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2549,7 +2472,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2565,8 +2488,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2582,7 +2505,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2634,7 +2557,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2644,10 +2567,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2828,8 +2751,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2844,7 +2766,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2857,21 +2779,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3032,7 +2949,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3048,8 +2965,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3065,7 +2982,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3117,7 +3034,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3127,10 +3044,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3313,7 +3230,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3328,7 +3245,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3341,23 +3258,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3518,7 +3429,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3534,8 +3445,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3551,7 +3462,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3603,7 +3514,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3613,10 +3524,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3819,8 +3730,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3836,7 +3746,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3850,22 +3760,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4037,7 +3942,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4054,8 +3959,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4072,7 +3977,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4124,7 +4029,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4134,10 +4039,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4318,8 +4223,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4334,7 +4238,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4347,21 +4251,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4521,7 +4420,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4537,8 +4436,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4554,7 +4453,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4604,7 +4503,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4614,7 +4513,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4907,17 +4806,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4925,11 +4824,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -4950,15 +4849,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -4984,12 +4883,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5016,14 +4914,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5032,11 +4928,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5062,17 +4958,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5099,7 +4995,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5263,8 +5159,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5278,7 +5173,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5290,17 +5185,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5443,7 +5336,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5458,8 +5351,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5476,7 +5369,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5522,7 +5415,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5532,10 +5425,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5699,8 +5592,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5714,7 +5606,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5726,19 +5618,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5883,7 +5771,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5898,8 +5786,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5916,7 +5804,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -5962,7 +5850,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -5972,10 +5860,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6140,8 +6028,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6155,7 +6042,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6167,16 +6054,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6322,7 +6208,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6337,8 +6223,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6355,7 +6241,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6401,7 +6287,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6411,7 +6297,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8211,142 +8097,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 dc39560ce..54ec6d668 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 @@ -1056,17 +1056,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1710,41 +1710,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1893,66 +1880,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1965,34 +1942,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2017,25 +1986,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2046,21 +2009,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2068,27 +2029,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2097,21 +2051,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2137,44 +2085,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2190,23 +2123,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2387,8 +2316,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2403,7 +2331,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2416,21 +2344,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2591,7 +2514,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2607,8 +2530,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2624,7 +2547,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2676,7 +2599,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2686,10 +2609,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2870,8 +2793,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2886,7 +2808,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2899,21 +2821,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3074,7 +2991,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3090,8 +3007,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3107,7 +3024,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3159,7 +3076,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3169,10 +3086,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3355,7 +3272,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3370,7 +3287,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3383,23 +3300,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3560,7 +3471,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3576,8 +3487,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3593,7 +3504,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3645,7 +3556,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3655,10 +3566,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3861,8 +3772,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3878,7 +3788,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3892,22 +3802,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4079,7 +3984,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4096,8 +4001,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4114,7 +4019,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4166,7 +4071,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4176,10 +4081,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4360,8 +4265,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4376,7 +4280,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4389,21 +4293,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4563,7 +4462,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4579,8 +4478,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4596,7 +4495,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4646,7 +4545,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4656,7 +4555,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4949,17 +4848,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4967,11 +4866,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -4992,15 +4891,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5026,12 +4925,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5058,14 +4956,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5074,11 +4970,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5104,17 +5000,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5141,7 +5037,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5305,8 +5201,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5320,7 +5215,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5332,17 +5227,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5485,7 +5378,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5500,8 +5393,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5518,7 +5411,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5564,7 +5457,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5574,10 +5467,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5741,8 +5634,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5756,7 +5648,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5768,19 +5660,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5925,7 +5813,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5940,8 +5828,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5958,7 +5846,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6004,7 +5892,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6014,10 +5902,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6182,8 +6070,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6197,7 +6084,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6209,16 +6096,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6364,7 +6250,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6379,8 +6265,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6397,7 +6283,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6443,7 +6329,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6453,7 +6339,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8253,142 +8139,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt index 4a5b03c21..827918264 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponse.kt @@ -1558,18 +1558,18 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with * `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -2237,45 +2237,32 @@ private constructor( } /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ - fun adjustment( - planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment( - planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = - adjustment( - Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount) - ) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = + adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = + adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -2428,67 +2415,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = - null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -2501,34 +2477,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2553,25 +2521,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2582,21 +2544,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2604,27 +2564,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2633,21 +2586,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2678,45 +2625,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Adjustment(planPhasePercentageDiscount = it, _json = json) - } ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Adjustment(percentageDiscount = it, _json = json) } + ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2732,23 +2663,21 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> + generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> + generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2935,7 +2864,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * [UsageDiscount]. * * The following fields are required: * ```java @@ -2950,7 +2879,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2964,21 +2893,16 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3140,7 +3064,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3156,8 +3080,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3173,7 +3097,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -3225,7 +3149,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -3235,10 +3159,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3425,7 +3349,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * [AmountDiscount]. * * The following fields are required: * ```java @@ -3440,7 +3364,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3454,22 +3378,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties - .toMutableMap() + amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3631,7 +3550,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3647,8 +3566,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3664,7 +3583,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3716,7 +3635,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3726,10 +3645,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3917,7 +3836,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3932,7 +3851,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3947,24 +3866,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: - PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -4126,7 +4038,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4142,8 +4054,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4159,7 +4071,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -4211,7 +4123,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -4221,10 +4133,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4434,8 +4346,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -4451,7 +4362,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4466,22 +4377,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4654,7 +4560,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4671,8 +4577,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4689,7 +4595,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4741,7 +4647,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4751,10 +4657,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4940,8 +4846,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4956,7 +4861,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4970,21 +4875,16 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -5145,7 +5045,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5161,8 +5061,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -5178,7 +5078,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -5228,7 +5128,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -5238,7 +5138,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -5536,17 +5436,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -5554,11 +5454,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5579,15 +5479,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5613,12 +5513,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5645,15 +5544,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic - fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5662,11 +5558,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5693,22 +5589,19 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(amount = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(amount = it, _json = json) + } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(usage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(usage = it, _json = json) + } ?: DiscountInterval(_json = json) } } @@ -5733,7 +5626,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5899,8 +5792,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5914,7 +5806,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5926,19 +5818,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -6084,7 +5972,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6099,8 +5987,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -6116,7 +6004,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -6162,7 +6050,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -6172,10 +6060,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6342,8 +6230,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -6357,7 +6244,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6369,23 +6256,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = - apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { - it.toMutableList() - } - appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() - } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } + appliesToPriceIntervalIds = + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() + } /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = @@ -6533,7 +6413,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6548,8 +6428,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6565,7 +6445,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6611,7 +6491,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6621,10 +6501,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6791,8 +6671,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6806,7 +6685,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6818,19 +6697,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = - usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6979,7 +6854,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6994,8 +6869,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -7011,7 +6886,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -7057,7 +6932,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -7067,7 +6942,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8922,156 +8797,154 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = - price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with * `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** * Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** * Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** * Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice - ) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt index 1cce17ea5..fbffe6af2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponse.kt @@ -1558,18 +1558,18 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with * `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -2237,45 +2237,32 @@ private constructor( } /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ - fun adjustment( - planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment( - planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = - adjustment( - Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount) - ) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = + adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = + adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -2428,67 +2415,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = - null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -2501,34 +2477,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2553,25 +2521,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2582,21 +2544,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2604,27 +2564,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2633,21 +2586,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2678,45 +2625,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Adjustment(planPhasePercentageDiscount = it, _json = json) - } ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Adjustment(percentageDiscount = it, _json = json) } + ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2732,23 +2663,21 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> + generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> + generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2935,7 +2864,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * [UsageDiscount]. * * The following fields are required: * ```java @@ -2950,7 +2879,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2964,21 +2893,16 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3140,7 +3064,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3156,8 +3080,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3173,7 +3097,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -3225,7 +3149,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -3235,10 +3159,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3425,7 +3349,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * [AmountDiscount]. * * The following fields are required: * ```java @@ -3440,7 +3364,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3454,22 +3378,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties - .toMutableMap() + amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3631,7 +3550,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3647,8 +3566,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3664,7 +3583,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3716,7 +3635,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3726,10 +3645,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3917,7 +3836,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3932,7 +3851,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3947,24 +3866,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: - PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -4126,7 +4038,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4142,8 +4054,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4159,7 +4071,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -4211,7 +4123,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -4221,10 +4133,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4434,8 +4346,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -4451,7 +4362,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4466,22 +4377,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4654,7 +4560,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4671,8 +4577,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4689,7 +4595,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4741,7 +4647,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4751,10 +4657,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4940,8 +4846,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4956,7 +4861,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4970,21 +4875,16 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -5145,7 +5045,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5161,8 +5061,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -5178,7 +5078,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -5228,7 +5128,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -5238,7 +5138,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -5536,17 +5436,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -5554,11 +5454,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5579,15 +5479,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5613,12 +5513,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5645,15 +5544,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic - fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5662,11 +5558,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5693,22 +5589,19 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(amount = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(amount = it, _json = json) + } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(usage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(usage = it, _json = json) + } ?: DiscountInterval(_json = json) } } @@ -5733,7 +5626,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5899,8 +5792,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5914,7 +5806,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5926,19 +5818,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -6084,7 +5972,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6099,8 +5987,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -6116,7 +6004,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -6162,7 +6050,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -6172,10 +6060,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6342,8 +6230,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -6357,7 +6244,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6369,23 +6256,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = - apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { - it.toMutableList() - } - appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() - } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } + appliesToPriceIntervalIds = + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() + } /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = @@ -6533,7 +6413,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6548,8 +6428,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6565,7 +6445,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6611,7 +6491,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6621,10 +6501,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6791,8 +6671,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6806,7 +6685,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6818,19 +6697,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = - usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6979,7 +6854,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6994,8 +6869,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -7011,7 +6886,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -7057,7 +6932,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -7067,7 +6942,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8922,156 +8797,154 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = - price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with * `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** * Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** * Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** * Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice - ) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt index 19dcc39e3..e62a3d9a9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponse.kt @@ -1558,18 +1558,18 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with * `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -2237,45 +2237,32 @@ private constructor( } /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ - fun adjustment( - planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment( - planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = - adjustment( - Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount) - ) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = + adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = + adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -2428,67 +2415,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = - null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -2501,34 +2477,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2553,25 +2521,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2582,21 +2544,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2604,27 +2564,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2633,21 +2586,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2678,45 +2625,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Adjustment(planPhasePercentageDiscount = it, _json = json) - } ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Adjustment(percentageDiscount = it, _json = json) } + ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2732,23 +2663,21 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> + generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> + generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2935,7 +2864,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * [UsageDiscount]. * * The following fields are required: * ```java @@ -2950,7 +2879,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2964,21 +2893,16 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3140,7 +3064,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3156,8 +3080,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3173,7 +3097,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -3225,7 +3149,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -3235,10 +3159,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3425,7 +3349,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * [AmountDiscount]. * * The following fields are required: * ```java @@ -3440,7 +3364,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3454,22 +3378,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties - .toMutableMap() + amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3631,7 +3550,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3647,8 +3566,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3664,7 +3583,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3716,7 +3635,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3726,10 +3645,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3917,7 +3836,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3932,7 +3851,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3947,24 +3866,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: - PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -4126,7 +4038,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4142,8 +4054,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4159,7 +4071,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -4211,7 +4123,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -4221,10 +4133,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4434,8 +4346,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -4451,7 +4362,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4466,22 +4377,17 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4654,7 +4560,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4671,8 +4577,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4689,7 +4595,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4741,7 +4647,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4751,10 +4657,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4940,8 +4846,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4956,7 +4861,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4970,21 +4875,16 @@ private constructor( mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -5145,7 +5045,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5161,8 +5061,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -5178,7 +5078,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -5228,7 +5128,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -5238,7 +5138,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -5536,17 +5436,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -5554,11 +5454,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5579,15 +5479,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5613,12 +5513,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5645,15 +5544,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic - fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5662,11 +5558,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5693,22 +5589,19 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(amount = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(amount = it, _json = json) + } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(usage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(usage = it, _json = json) + } ?: DiscountInterval(_json = json) } } @@ -5733,7 +5626,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5899,8 +5792,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5914,7 +5806,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5926,19 +5818,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -6084,7 +5972,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6099,8 +5987,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -6116,7 +6004,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -6162,7 +6050,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -6172,10 +6060,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6342,8 +6230,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -6357,7 +6244,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6369,23 +6256,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = - apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { - it.toMutableList() - } - appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() - } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } + appliesToPriceIntervalIds = + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() + } /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = @@ -6533,7 +6413,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6548,8 +6428,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6565,7 +6445,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6611,7 +6491,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6621,10 +6501,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6791,8 +6671,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6806,7 +6685,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6818,19 +6697,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = - usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6979,7 +6854,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6994,8 +6869,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -7011,7 +6886,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -7057,7 +6932,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -7067,7 +6942,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8922,156 +8797,154 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = - price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with * `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** * Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** * Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** * Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice - ) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 dd5093955..d4ff624e8 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 @@ -3728,32 +3728,26 @@ private constructor( /** * Alias for calling [adjustment] with - * `Adjustment.ofNewPercentageDiscount(newPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = - adjustment(Adjustment.ofNewPercentageDiscount(newPercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewUsageDiscount(newUsageDiscount)`. - */ - fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = - adjustment(Adjustment.ofNewUsageDiscount(newUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewAmountDiscount(newAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = - adjustment(Adjustment.ofNewAmountDiscount(newAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMinimum(newMinimum)`. */ - fun adjustment(newMinimum: Adjustment.NewMinimum) = - adjustment(Adjustment.ofNewMinimum(newMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMaximum(newMaximum)`. */ - fun adjustment(newMaximum: Adjustment.NewMaximum) = - adjustment(Adjustment.ofNewMaximum(newMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** * The end date of the adjustment interval. This is the date that the adjustment will @@ -3901,60 +3895,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val newPercentageDiscount: NewPercentageDiscount? = null, - private val newUsageDiscount: NewUsageDiscount? = null, - private val newAmountDiscount: NewAmountDiscount? = null, - private val newMinimum: NewMinimum? = null, - private val newMaximum: NewMaximum? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun newPercentageDiscount(): Optional = - Optional.ofNullable(newPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun newUsageDiscount(): Optional = - Optional.ofNullable(newUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun newAmountDiscount(): Optional = - Optional.ofNullable(newAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun newMinimum(): Optional = Optional.ofNullable(newMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun newMaximum(): Optional = Optional.ofNullable(newMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isNewPercentageDiscount(): Boolean = newPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isNewUsageDiscount(): Boolean = newUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isNewAmountDiscount(): Boolean = newAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isNewMinimum(): Boolean = newMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isNewMaximum(): Boolean = newMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asNewPercentageDiscount(): NewPercentageDiscount = - newPercentageDiscount.getOrThrow("newPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asNewUsageDiscount(): NewUsageDiscount = - newUsageDiscount.getOrThrow("newUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asNewAmountDiscount(): NewAmountDiscount = - newAmountDiscount.getOrThrow("newAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asNewMinimum(): NewMinimum = newMinimum.getOrThrow("newMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asNewMaximum(): NewMaximum = newMaximum.getOrThrow("newMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newPercentageDiscount != null -> - visitor.visitNewPercentageDiscount(newPercentageDiscount) - newUsageDiscount != null -> visitor.visitNewUsageDiscount(newUsageDiscount) - newAmountDiscount != null -> visitor.visitNewAmountDiscount(newAmountDiscount) - newMinimum != null -> visitor.visitNewMinimum(newMinimum) - newMaximum != null -> visitor.visitNewMaximum(newMaximum) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -3967,26 +3957,26 @@ private constructor( accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - newPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) { - newUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) { - newAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitNewMinimum(newMinimum: NewMinimum) { - newMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitNewMaximum(newMaximum: NewMaximum) { - newMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -4011,19 +4001,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount - ) = newPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - newUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - newAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitNewMinimum(newMinimum: NewMinimum) = newMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitNewMaximum(newMaximum: NewMaximum) = newMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -4034,19 +4024,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && newPercentageDiscount == other.newPercentageDiscount && newUsageDiscount == other.newUsageDiscount && newAmountDiscount == other.newAmountDiscount && newMinimum == other.newMinimum && newMaximum == other.newMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPercentageDiscount, newUsageDiscount, newAmountDiscount, newMinimum, newMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentageDiscount, usageDiscount, amountDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - newPercentageDiscount != null -> - "Adjustment{newPercentageDiscount=$newPercentageDiscount}" - newUsageDiscount != null -> "Adjustment{newUsageDiscount=$newUsageDiscount}" - newAmountDiscount != null -> "Adjustment{newAmountDiscount=$newAmountDiscount}" - newMinimum != null -> "Adjustment{newMinimum=$newMinimum}" - newMaximum != null -> "Adjustment{newMaximum=$newMaximum}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -4054,22 +4044,20 @@ private constructor( companion object { @JvmStatic - fun ofNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount) = - Adjustment(newPercentageDiscount = newPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) @JvmStatic - fun ofNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - Adjustment(newUsageDiscount = newUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - Adjustment(newAmountDiscount = newAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) - @JvmStatic - fun ofNewMinimum(newMinimum: NewMinimum) = Adjustment(newMinimum = newMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofNewMaximum(newMaximum: NewMaximum) = Adjustment(newMaximum = newMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -4078,15 +4066,15 @@ private constructor( */ interface Visitor { - fun visitNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitNewMinimum(newMinimum: NewMinimum): T + fun visitMinimum(minimum: Minimum): T - fun visitNewMaximum(newMaximum: NewMaximum): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -4112,28 +4100,28 @@ private constructor( when (adjustmentType) { "percentage_discount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(newPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "usage_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newUsageDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newAmountDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMinimum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMaximum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) } ?: Adjustment(_json = json) } } @@ -4150,21 +4138,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.newPercentageDiscount != null -> - generator.writeObject(value.newPercentageDiscount) - value.newUsageDiscount != null -> - generator.writeObject(value.newUsageDiscount) - value.newAmountDiscount != null -> - generator.writeObject(value.newAmountDiscount) - value.newMinimum != null -> generator.writeObject(value.newMinimum) - value.newMaximum != null -> generator.writeObject(value.newMaximum) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class NewPercentageDiscount + class PercentageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -4282,7 +4268,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPercentageDiscount]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -4293,7 +4279,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPercentageDiscount]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") @@ -4303,14 +4289,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - adjustmentType = newPercentageDiscount.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - newPercentageDiscount.appliesToPriceIds.map { it.toMutableList() } - percentageDiscount = newPercentageDiscount.percentageDiscount - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.percentageDiscount = percentageDiscount.percentageDiscount + isInvoiceLevel = percentageDiscount.isInvoiceLevel additionalProperties = - newPercentageDiscount.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } /** @@ -4411,7 +4397,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPercentageDiscount]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4423,8 +4409,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPercentageDiscount = - NewPercentageDiscount( + fun build(): PercentageDiscount = + PercentageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -4437,7 +4423,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPercentageDiscount = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -4483,7 +4469,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4493,10 +4479,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "PercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewUsageDiscount + class UsageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -4612,7 +4598,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewUsageDiscount]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -4623,7 +4609,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewUsageDiscount]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("usage_discount") @@ -4633,13 +4619,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - adjustmentType = newUsageDiscount.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - newUsageDiscount.appliesToPriceIds.map { it.toMutableList() } - usageDiscount = newUsageDiscount.usageDiscount - isInvoiceLevel = newUsageDiscount.isInvoiceLevel - additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.usageDiscount = usageDiscount.usageDiscount + isInvoiceLevel = usageDiscount.isInvoiceLevel + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } /** @@ -4740,7 +4726,7 @@ private constructor( } /** - * Returns an immutable instance of [NewUsageDiscount]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4752,8 +4738,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewUsageDiscount = - NewUsageDiscount( + fun build(): UsageDiscount = + UsageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -4766,7 +4752,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewUsageDiscount = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -4810,7 +4796,7 @@ private constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4820,10 +4806,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "UsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewAmountDiscount + class AmountDiscount private constructor( private val adjustmentType: JsonValue, private val amountDiscount: JsonField, @@ -4939,8 +4925,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAmountDiscount]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -4951,7 +4936,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAmountDiscount]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("amount_discount") @@ -4961,13 +4946,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - adjustmentType = newAmountDiscount.adjustmentType - amountDiscount = newAmountDiscount.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - newAmountDiscount.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = newAmountDiscount.isInvoiceLevel - additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } /** @@ -5068,7 +5053,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAmountDiscount]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5080,8 +5065,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAmountDiscount = - NewAmountDiscount( + fun build(): AmountDiscount = + AmountDiscount( adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -5094,7 +5079,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAmountDiscount = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -5138,7 +5123,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -5148,10 +5133,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "AmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMinimum + class Minimum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -5289,7 +5274,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMinimum]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -5301,7 +5286,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMinimum]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("minimum") @@ -5312,13 +5297,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMinimum: NewMinimum) = apply { - adjustmentType = newMinimum.adjustmentType - appliesToPriceIds = newMinimum.appliesToPriceIds.map { it.toMutableList() } - itemId = newMinimum.itemId - minimumAmount = newMinimum.minimumAmount - isInvoiceLevel = newMinimum.isInvoiceLevel - additionalProperties = newMinimum.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + isInvoiceLevel = minimum.isInvoiceLevel + additionalProperties = minimum.additionalProperties.toMutableMap() } /** @@ -5431,7 +5416,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMinimum]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5444,8 +5429,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMinimum = - NewMinimum( + fun build(): Minimum = + Minimum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5459,7 +5444,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMinimum = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -5505,7 +5490,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Minimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -5515,10 +5500,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Minimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMaximum + class Maximum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -5634,7 +5619,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMaximum]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -5645,7 +5630,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMaximum]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("maximum") @@ -5655,12 +5640,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMaximum: NewMaximum) = apply { - adjustmentType = newMaximum.adjustmentType - appliesToPriceIds = newMaximum.appliesToPriceIds.map { it.toMutableList() } - maximumAmount = newMaximum.maximumAmount - isInvoiceLevel = newMaximum.isInvoiceLevel - additionalProperties = newMaximum.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + maximumAmount = maximum.maximumAmount + isInvoiceLevel = maximum.isInvoiceLevel + additionalProperties = maximum.additionalProperties.toMutableMap() } /** @@ -5761,7 +5746,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMaximum]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5773,8 +5758,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMaximum = - NewMaximum( + fun build(): Maximum = + Maximum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5787,7 +5772,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMaximum = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -5831,7 +5816,7 @@ private constructor( return true } - return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -5841,7 +5826,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Maximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -6333,244 +6318,127 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** - * Alias for calling [price] with `Price.ofNewSubscriptionUnit(newSubscriptionUnit)`. - */ - fun price(newSubscriptionUnit: Price.NewSubscriptionUnitPrice) = - price(Price.ofNewSubscriptionUnit(newSubscriptionUnit)) + /** Alias for calling [price] with `Price.ofUnit(unit)`. */ + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionPackage(newSubscriptionPackage)`. - */ - fun price(newSubscriptionPackage: Price.NewSubscriptionPackagePrice) = - price(Price.ofNewSubscriptionPackage(newSubscriptionPackage)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)`. - */ - fun price(newSubscriptionMatrix: Price.NewSubscriptionMatrixPrice) = - price(Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)) + /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTiered(newSubscriptionTiered)`. - */ - fun price(newSubscriptionTiered: Price.NewSubscriptionTieredPrice) = - price(Price.ofNewSubscriptionTiered(newSubscriptionTiered)) + /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)`. - */ - fun price(newSubscriptionTieredBps: Price.NewSubscriptionTieredBpsPrice) = - price(Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)) + /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) - /** Alias for calling [price] with `Price.ofNewSubscriptionBps(newSubscriptionBps)`. */ - fun price(newSubscriptionBps: Price.NewSubscriptionBpsPrice) = - price(Price.ofNewSubscriptionBps(newSubscriptionBps)) + /** Alias for calling [price] with `Price.ofBps(bps)`. */ + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)`. - */ - fun price(newSubscriptionBulkBps: Price.NewSubscriptionBulkBpsPrice) = - price(Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)) + /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) - /** - * Alias for calling [price] with `Price.ofNewSubscriptionBulk(newSubscriptionBulk)`. - */ - fun price(newSubscriptionBulk: Price.NewSubscriptionBulkPrice) = - price(Price.ofNewSubscriptionBulk(newSubscriptionBulk)) + /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount)`. + * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price( - newSubscriptionThresholdTotalAmount: Price.NewSubscriptionThresholdTotalAmountPrice - ) = - price( - Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount) - ) + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = + price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)`. - */ - fun price(newSubscriptionTieredPackage: Price.NewSubscriptionTieredPackagePrice) = - price(Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)) + /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ + fun price(tieredPackage: Price.TieredPackage) = + price(Price.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)`. - */ - fun price( - newSubscriptionTieredWithMinimum: Price.NewSubscriptionTieredWithMinimumPrice - ) = price(Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)) + /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun price(tieredWithMinimum: Price.TieredWithMinimum) = + price(Price.ofTieredWithMinimum(tieredWithMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)`. - */ - fun price(newSubscriptionUnitWithPercent: Price.NewSubscriptionUnitWithPercentPrice) = - price(Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)) + /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun price(unitWithPercent: Price.UnitWithPercent) = + price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionPackageWithAllocation(newSubscriptionPackageWithAllocation)`. + * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price( - newSubscriptionPackageWithAllocation: - Price.NewSubscriptionPackageWithAllocationPrice - ) = - price( - Price.ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - ) + fun price(packageWithAllocation: Price.PackageWithAllocation) = + price(Price.ofPackageWithAllocation(packageWithAllocation)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)`. + * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price( - newSubscriptionTierWithProration: Price.NewSubscriptionTierWithProrationPrice - ) = price(Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)) + fun price(tieredWithProration: Price.TieredWithProration) = + price(Price.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)`. - */ - fun price( - newSubscriptionUnitWithProration: Price.NewSubscriptionUnitWithProrationPrice - ) = price(Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)) + /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun price(unitWithProration: Price.UnitWithProration) = + price(Price.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)`. - */ - fun price( - newSubscriptionGroupedAllocation: Price.NewSubscriptionGroupedAllocationPrice - ) = price(Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)) + /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun price(groupedAllocation: Price.GroupedAllocation) = + price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithProratedMinimum(newSubscriptionGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price( - newSubscriptionGroupedWithProratedMinimum: - Price.NewSubscriptionGroupedWithProratedMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - ) + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = + price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)`. - */ - fun price( - newSubscriptionBulkWithProration: Price.NewSubscriptionBulkWithProrationPrice - ) = price(Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)) + /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun price(bulkWithProration: Price.BulkWithProration) = + price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithUnitPricing(newSubscriptionScalableMatrixWithUnitPricing)`. + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithUnitPricing: - Price.NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - ) + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = + price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithTieredPricing(newSubscriptionScalableMatrixWithTieredPricing)`. + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithTieredPricing: - Price.NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - ) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionCumulativeGroupedBulk(newSubscriptionCumulativeGroupedBulk)`. + * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price( - newSubscriptionCumulativeGroupedBulk: - Price.NewSubscriptionCumulativeGroupedBulkPrice - ) = - price( - Price.ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - ) + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = + price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMaxGroupTieredPackage(newSubscriptionMaxGroupTieredPackage)`. + * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price( - newSubscriptionMaxGroupTieredPackage: - Price.NewSubscriptionMaxGroupTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - ) + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = + price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithMeteredMinimum(newSubscriptionGroupedWithMeteredMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price( - newSubscriptionGroupedWithMeteredMinimum: - Price.NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - ) + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = + price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrixWithDisplayName(newSubscriptionMatrixWithDisplayName)`. + * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price( - newSubscriptionMatrixWithDisplayName: - Price.NewSubscriptionMatrixWithDisplayNamePrice - ) = - price( - Price.ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - ) + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = + price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage)`. + * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price( - newSubscriptionGroupedTieredPackage: Price.NewSubscriptionGroupedTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage) - ) + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = + price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** The id of the price to add to the subscription. */ fun priceId(priceId: String?) = priceId(JsonField.ofNullable(priceId)) @@ -7638,401 +7506,257 @@ private constructor( @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val newSubscriptionUnit: NewSubscriptionUnitPrice? = null, - private val newSubscriptionPackage: NewSubscriptionPackagePrice? = null, - private val newSubscriptionMatrix: NewSubscriptionMatrixPrice? = null, - private val newSubscriptionTiered: NewSubscriptionTieredPrice? = null, - private val newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice? = null, - private val newSubscriptionBps: NewSubscriptionBpsPrice? = null, - private val newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice? = null, - private val newSubscriptionBulk: NewSubscriptionBulkPrice? = null, - private val newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice? = - null, - private val newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice? = null, - private val newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice? = - null, - private val newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice? = null, - private val newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice? = - null, - private val newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice? = - null, - private val newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice? = - null, - private val newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice? = - null, - private val newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice? = - null, - private val newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice? = - null, - private val newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice? = - null, - private val newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice? = - null, - private val newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice? = - null, - private val newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice? = - null, - private val newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice? = - null, - private val newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice? = - null, - private val newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice? = - null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val bulkWithProration: BulkWithProration? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, private val _json: JsonValue? = null, ) { - fun newSubscriptionUnit(): Optional = - Optional.ofNullable(newSubscriptionUnit) + fun unit(): Optional = Optional.ofNullable(unit) - fun newSubscriptionPackage(): Optional = - Optional.ofNullable(newSubscriptionPackage) + fun package_(): Optional = Optional.ofNullable(package_) - fun newSubscriptionMatrix(): Optional = - Optional.ofNullable(newSubscriptionMatrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newSubscriptionTiered(): Optional = - Optional.ofNullable(newSubscriptionTiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newSubscriptionTieredBps(): Optional = - Optional.ofNullable(newSubscriptionTieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newSubscriptionBps(): Optional = - Optional.ofNullable(newSubscriptionBps) + fun bps(): Optional = Optional.ofNullable(bps) - fun newSubscriptionBulkBps(): Optional = - Optional.ofNullable(newSubscriptionBulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newSubscriptionBulk(): Optional = - Optional.ofNullable(newSubscriptionBulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newSubscriptionThresholdTotalAmount(): - Optional = - Optional.ofNullable(newSubscriptionThresholdTotalAmount) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newSubscriptionTieredPackage(): Optional = - Optional.ofNullable(newSubscriptionTieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newSubscriptionTieredWithMinimum(): - Optional = - Optional.ofNullable(newSubscriptionTieredWithMinimum) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newSubscriptionUnitWithPercent(): Optional = - Optional.ofNullable(newSubscriptionUnitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newSubscriptionPackageWithAllocation(): - Optional = - Optional.ofNullable(newSubscriptionPackageWithAllocation) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newSubscriptionTierWithProration(): - Optional = - Optional.ofNullable(newSubscriptionTierWithProration) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newSubscriptionUnitWithProration(): - Optional = - Optional.ofNullable(newSubscriptionUnitWithProration) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newSubscriptionGroupedAllocation(): - Optional = - Optional.ofNullable(newSubscriptionGroupedAllocation) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newSubscriptionGroupedWithProratedMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithProratedMinimum) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newSubscriptionBulkWithProration(): - Optional = - Optional.ofNullable(newSubscriptionBulkWithProration) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newSubscriptionScalableMatrixWithUnitPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithUnitPricing) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newSubscriptionScalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithTieredPricing) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newSubscriptionCumulativeGroupedBulk(): - Optional = - Optional.ofNullable(newSubscriptionCumulativeGroupedBulk) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun newSubscriptionMaxGroupTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionMaxGroupTieredPackage) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newSubscriptionGroupedWithMeteredMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithMeteredMinimum) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newSubscriptionMatrixWithDisplayName(): - Optional = - Optional.ofNullable(newSubscriptionMatrixWithDisplayName) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newSubscriptionGroupedTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionGroupedTieredPackage) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun isNewSubscriptionUnit(): Boolean = newSubscriptionUnit != null + fun isUnit(): Boolean = unit != null - fun isNewSubscriptionPackage(): Boolean = newSubscriptionPackage != null + fun isPackage(): Boolean = package_ != null - fun isNewSubscriptionMatrix(): Boolean = newSubscriptionMatrix != null + fun isMatrix(): Boolean = matrix != null - fun isNewSubscriptionTiered(): Boolean = newSubscriptionTiered != null + fun isTiered(): Boolean = tiered != null - fun isNewSubscriptionTieredBps(): Boolean = newSubscriptionTieredBps != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewSubscriptionBps(): Boolean = newSubscriptionBps != null + fun isBps(): Boolean = bps != null - fun isNewSubscriptionBulkBps(): Boolean = newSubscriptionBulkBps != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewSubscriptionBulk(): Boolean = newSubscriptionBulk != null + fun isBulk(): Boolean = bulk != null - fun isNewSubscriptionThresholdTotalAmount(): Boolean = - newSubscriptionThresholdTotalAmount != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewSubscriptionTieredPackage(): Boolean = newSubscriptionTieredPackage != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewSubscriptionTieredWithMinimum(): Boolean = - newSubscriptionTieredWithMinimum != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewSubscriptionUnitWithPercent(): Boolean = newSubscriptionUnitWithPercent != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewSubscriptionPackageWithAllocation(): Boolean = - newSubscriptionPackageWithAllocation != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewSubscriptionTierWithProration(): Boolean = - newSubscriptionTierWithProration != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewSubscriptionUnitWithProration(): Boolean = - newSubscriptionUnitWithProration != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewSubscriptionGroupedAllocation(): Boolean = - newSubscriptionGroupedAllocation != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewSubscriptionGroupedWithProratedMinimum(): Boolean = - newSubscriptionGroupedWithProratedMinimum != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewSubscriptionBulkWithProration(): Boolean = - newSubscriptionBulkWithProration != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewSubscriptionScalableMatrixWithUnitPricing(): Boolean = - newSubscriptionScalableMatrixWithUnitPricing != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewSubscriptionScalableMatrixWithTieredPricing(): Boolean = - newSubscriptionScalableMatrixWithTieredPricing != null + fun isScalableMatrixWithTieredPricing(): Boolean = + scalableMatrixWithTieredPricing != null - fun isNewSubscriptionCumulativeGroupedBulk(): Boolean = - newSubscriptionCumulativeGroupedBulk != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun isNewSubscriptionMaxGroupTieredPackage(): Boolean = - newSubscriptionMaxGroupTieredPackage != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewSubscriptionGroupedWithMeteredMinimum(): Boolean = - newSubscriptionGroupedWithMeteredMinimum != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewSubscriptionMatrixWithDisplayName(): Boolean = - newSubscriptionMatrixWithDisplayName != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewSubscriptionGroupedTieredPackage(): Boolean = - newSubscriptionGroupedTieredPackage != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun asNewSubscriptionUnit(): NewSubscriptionUnitPrice = - newSubscriptionUnit.getOrThrow("newSubscriptionUnit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewSubscriptionPackage(): NewSubscriptionPackagePrice = - newSubscriptionPackage.getOrThrow("newSubscriptionPackage") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewSubscriptionMatrix(): NewSubscriptionMatrixPrice = - newSubscriptionMatrix.getOrThrow("newSubscriptionMatrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewSubscriptionTiered(): NewSubscriptionTieredPrice = - newSubscriptionTiered.getOrThrow("newSubscriptionTiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewSubscriptionTieredBps(): NewSubscriptionTieredBpsPrice = - newSubscriptionTieredBps.getOrThrow("newSubscriptionTieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewSubscriptionBps(): NewSubscriptionBpsPrice = - newSubscriptionBps.getOrThrow("newSubscriptionBps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewSubscriptionBulkBps(): NewSubscriptionBulkBpsPrice = - newSubscriptionBulkBps.getOrThrow("newSubscriptionBulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewSubscriptionBulk(): NewSubscriptionBulkPrice = - newSubscriptionBulk.getOrThrow("newSubscriptionBulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewSubscriptionThresholdTotalAmount(): NewSubscriptionThresholdTotalAmountPrice = - newSubscriptionThresholdTotalAmount.getOrThrow( - "newSubscriptionThresholdTotalAmount" - ) + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewSubscriptionTieredPackage(): NewSubscriptionTieredPackagePrice = - newSubscriptionTieredPackage.getOrThrow("newSubscriptionTieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewSubscriptionTieredWithMinimum(): NewSubscriptionTieredWithMinimumPrice = - newSubscriptionTieredWithMinimum.getOrThrow("newSubscriptionTieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewSubscriptionUnitWithPercent(): NewSubscriptionUnitWithPercentPrice = - newSubscriptionUnitWithPercent.getOrThrow("newSubscriptionUnitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewSubscriptionPackageWithAllocation(): - NewSubscriptionPackageWithAllocationPrice = - newSubscriptionPackageWithAllocation.getOrThrow( - "newSubscriptionPackageWithAllocation" - ) + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewSubscriptionTierWithProration(): NewSubscriptionTierWithProrationPrice = - newSubscriptionTierWithProration.getOrThrow("newSubscriptionTierWithProration") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewSubscriptionUnitWithProration(): NewSubscriptionUnitWithProrationPrice = - newSubscriptionUnitWithProration.getOrThrow("newSubscriptionUnitWithProration") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewSubscriptionGroupedAllocation(): NewSubscriptionGroupedAllocationPrice = - newSubscriptionGroupedAllocation.getOrThrow("newSubscriptionGroupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewSubscriptionGroupedWithProratedMinimum(): - NewSubscriptionGroupedWithProratedMinimumPrice = - newSubscriptionGroupedWithProratedMinimum.getOrThrow( - "newSubscriptionGroupedWithProratedMinimum" - ) + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewSubscriptionBulkWithProration(): NewSubscriptionBulkWithProrationPrice = - newSubscriptionBulkWithProration.getOrThrow("newSubscriptionBulkWithProration") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewSubscriptionScalableMatrixWithUnitPricing(): - NewSubscriptionScalableMatrixWithUnitPricingPrice = - newSubscriptionScalableMatrixWithUnitPricing.getOrThrow( - "newSubscriptionScalableMatrixWithUnitPricing" - ) + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewSubscriptionScalableMatrixWithTieredPricing(): - NewSubscriptionScalableMatrixWithTieredPricingPrice = - newSubscriptionScalableMatrixWithTieredPricing.getOrThrow( - "newSubscriptionScalableMatrixWithTieredPricing" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewSubscriptionCumulativeGroupedBulk(): - NewSubscriptionCumulativeGroupedBulkPrice = - newSubscriptionCumulativeGroupedBulk.getOrThrow( - "newSubscriptionCumulativeGroupedBulk" - ) + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") - fun asNewSubscriptionMaxGroupTieredPackage(): - NewSubscriptionMaxGroupTieredPackagePrice = - newSubscriptionMaxGroupTieredPackage.getOrThrow( - "newSubscriptionMaxGroupTieredPackage" - ) + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewSubscriptionGroupedWithMeteredMinimum(): - NewSubscriptionGroupedWithMeteredMinimumPrice = - newSubscriptionGroupedWithMeteredMinimum.getOrThrow( - "newSubscriptionGroupedWithMeteredMinimum" - ) + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewSubscriptionMatrixWithDisplayName(): - NewSubscriptionMatrixWithDisplayNamePrice = - newSubscriptionMatrixWithDisplayName.getOrThrow( - "newSubscriptionMatrixWithDisplayName" - ) + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewSubscriptionGroupedTieredPackage(): NewSubscriptionGroupedTieredPackagePrice = - newSubscriptionGroupedTieredPackage.getOrThrow( - "newSubscriptionGroupedTieredPackage" - ) + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newSubscriptionUnit != null -> - visitor.visitNewSubscriptionUnit(newSubscriptionUnit) - newSubscriptionPackage != null -> - visitor.visitNewSubscriptionPackage(newSubscriptionPackage) - newSubscriptionMatrix != null -> - visitor.visitNewSubscriptionMatrix(newSubscriptionMatrix) - newSubscriptionTiered != null -> - visitor.visitNewSubscriptionTiered(newSubscriptionTiered) - newSubscriptionTieredBps != null -> - visitor.visitNewSubscriptionTieredBps(newSubscriptionTieredBps) - newSubscriptionBps != null -> - visitor.visitNewSubscriptionBps(newSubscriptionBps) - newSubscriptionBulkBps != null -> - visitor.visitNewSubscriptionBulkBps(newSubscriptionBulkBps) - newSubscriptionBulk != null -> - visitor.visitNewSubscriptionBulk(newSubscriptionBulk) - newSubscriptionThresholdTotalAmount != null -> - visitor.visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount - ) - newSubscriptionTieredPackage != null -> - visitor.visitNewSubscriptionTieredPackage(newSubscriptionTieredPackage) - newSubscriptionTieredWithMinimum != null -> - visitor.visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum - ) - newSubscriptionUnitWithPercent != null -> - visitor.visitNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent) - newSubscriptionPackageWithAllocation != null -> - visitor.visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - newSubscriptionTierWithProration != null -> - visitor.visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration - ) - newSubscriptionUnitWithProration != null -> - visitor.visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration - ) - newSubscriptionGroupedAllocation != null -> - visitor.visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation - ) - newSubscriptionGroupedWithProratedMinimum != null -> - visitor.visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - newSubscriptionBulkWithProration != null -> - visitor.visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration - ) - newSubscriptionScalableMatrixWithUnitPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - newSubscriptionScalableMatrixWithTieredPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - newSubscriptionCumulativeGroupedBulk != null -> - visitor.visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - newSubscriptionMaxGroupTieredPackage != null -> - visitor.visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - newSubscriptionGroupedWithMeteredMinimum != null -> - visitor.visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - newSubscriptionMatrixWithDisplayName != null -> - visitor.visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - newSubscriptionGroupedTieredPackage != null -> - visitor.visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredWithProration != null -> + visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing ) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) else -> visitor.unknown(_json) } @@ -8045,164 +7769,126 @@ private constructor( accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) { - newSubscriptionUnit.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) { - newSubscriptionPackage.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) { - newSubscriptionMatrix.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) { - newSubscriptionTiered.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) { - newSubscriptionTieredBps.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) { - newSubscriptionBps.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) { - newSubscriptionBulkBps.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) { - newSubscriptionBulk.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newSubscriptionThresholdTotalAmount.validate() + thresholdTotalAmount.validate() } - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) { - newSubscriptionTieredPackage.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) { - newSubscriptionTieredWithMinimum.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) { - newSubscriptionUnitWithPercent.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newSubscriptionPackageWithAllocation.validate() + packageWithAllocation.validate() } - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newSubscriptionTierWithProration.validate() + tieredWithProration.validate() } - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) { - newSubscriptionUnitWithProration.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) { - newSubscriptionGroupedAllocation.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newSubscriptionGroupedWithProratedMinimum.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) { - newSubscriptionBulkWithProration.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newSubscriptionScalableMatrixWithUnitPricing.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newSubscriptionScalableMatrixWithTieredPricing.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newSubscriptionCumulativeGroupedBulk.validate() + cumulativeGroupedBulk.validate() } - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newSubscriptionMaxGroupTieredPackage.validate() + maxGroupTieredPackage.validate() } - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newSubscriptionGroupedWithMeteredMinimum.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newSubscriptionMatrixWithDisplayName.validate() + matrixWithDisplayName.validate() } - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newSubscriptionGroupedTieredPackage.validate() + groupedTieredPackage.validate() } } ) @@ -8227,115 +7913,83 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) = newSubscriptionUnit.validity() - - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) = newSubscriptionPackage.validity() - - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) = newSubscriptionMatrix.validity() - - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) = newSubscriptionTiered.validity() - - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = newSubscriptionTieredBps.validity() - - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) = newSubscriptionBps.validity() - - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) = newSubscriptionBulkBps.validity() - - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) = newSubscriptionBulk.validity() - - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice - ) = newSubscriptionThresholdTotalAmount.validity() - - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = newSubscriptionTieredPackage.validity() - - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = newSubscriptionTieredWithMinimum.validity() - - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = newSubscriptionUnitWithPercent.validity() - - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice - ) = newSubscriptionPackageWithAllocation.validity() - - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = newSubscriptionTierWithProration.validity() - - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = newSubscriptionUnitWithProration.validity() - - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = newSubscriptionGroupedAllocation.validity() - - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = newSubscriptionGroupedWithProratedMinimum.validity() - - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = newSubscriptionBulkWithProration.validity() - - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = newSubscriptionScalableMatrixWithUnitPricing.validity() - - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = newSubscriptionScalableMatrixWithTieredPricing.validity() - - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice - ) = newSubscriptionCumulativeGroupedBulk.validity() - - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice - ) = newSubscriptionMaxGroupTieredPackage.validity() - - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = newSubscriptionGroupedWithMeteredMinimum.validity() - - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice - ) = newSubscriptionMatrixWithDisplayName.validity() - - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice - ) = newSubscriptionGroupedTieredPackage.validity() + override fun visitUnit(unit: Unit) = unit.validity() + + override fun visitPackage(package_: Package) = package_.validity() + + override fun visitMatrix(matrix: Matrix) = matrix.validity() + + override fun visitTiered(tiered: Tiered) = tiered.validity() + + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() + + override fun visitBps(bps: Bps) = bps.validity() + + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() + + override fun visitBulk(bulk: Bulk) = bulk.validity() + + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() + + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() + + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() + + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() + + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() + + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() + + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() + + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() + + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() + + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() + + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() + + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() + + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() + + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() + + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() + + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() + + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -8346,215 +8000,141 @@ private constructor( return true } - return /* spotless:off */ other is Price && newSubscriptionUnit == other.newSubscriptionUnit && newSubscriptionPackage == other.newSubscriptionPackage && newSubscriptionMatrix == other.newSubscriptionMatrix && newSubscriptionTiered == other.newSubscriptionTiered && newSubscriptionTieredBps == other.newSubscriptionTieredBps && newSubscriptionBps == other.newSubscriptionBps && newSubscriptionBulkBps == other.newSubscriptionBulkBps && newSubscriptionBulk == other.newSubscriptionBulk && newSubscriptionThresholdTotalAmount == other.newSubscriptionThresholdTotalAmount && newSubscriptionTieredPackage == other.newSubscriptionTieredPackage && newSubscriptionTieredWithMinimum == other.newSubscriptionTieredWithMinimum && newSubscriptionUnitWithPercent == other.newSubscriptionUnitWithPercent && newSubscriptionPackageWithAllocation == other.newSubscriptionPackageWithAllocation && newSubscriptionTierWithProration == other.newSubscriptionTierWithProration && newSubscriptionUnitWithProration == other.newSubscriptionUnitWithProration && newSubscriptionGroupedAllocation == other.newSubscriptionGroupedAllocation && newSubscriptionGroupedWithProratedMinimum == other.newSubscriptionGroupedWithProratedMinimum && newSubscriptionBulkWithProration == other.newSubscriptionBulkWithProration && newSubscriptionScalableMatrixWithUnitPricing == other.newSubscriptionScalableMatrixWithUnitPricing && newSubscriptionScalableMatrixWithTieredPricing == other.newSubscriptionScalableMatrixWithTieredPricing && newSubscriptionCumulativeGroupedBulk == other.newSubscriptionCumulativeGroupedBulk && newSubscriptionMaxGroupTieredPackage == other.newSubscriptionMaxGroupTieredPackage && newSubscriptionGroupedWithMeteredMinimum == other.newSubscriptionGroupedWithMeteredMinimum && newSubscriptionMatrixWithDisplayName == other.newSubscriptionMatrixWithDisplayName && newSubscriptionGroupedTieredPackage == other.newSubscriptionGroupedTieredPackage /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && bulkWithProration == other.bulkWithProration && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk && maxGroupTieredPackage == other.maxGroupTieredPackage && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && groupedTieredPackage == other.groupedTieredPackage /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newSubscriptionUnit, newSubscriptionPackage, newSubscriptionMatrix, newSubscriptionTiered, newSubscriptionTieredBps, newSubscriptionBps, newSubscriptionBulkBps, newSubscriptionBulk, newSubscriptionThresholdTotalAmount, newSubscriptionTieredPackage, newSubscriptionTieredWithMinimum, newSubscriptionUnitWithPercent, newSubscriptionPackageWithAllocation, newSubscriptionTierWithProration, newSubscriptionUnitWithProration, newSubscriptionGroupedAllocation, newSubscriptionGroupedWithProratedMinimum, newSubscriptionBulkWithProration, newSubscriptionScalableMatrixWithUnitPricing, newSubscriptionScalableMatrixWithTieredPricing, newSubscriptionCumulativeGroupedBulk, newSubscriptionMaxGroupTieredPackage, newSubscriptionGroupedWithMeteredMinimum, newSubscriptionMatrixWithDisplayName, newSubscriptionGroupedTieredPackage) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, bulkWithProration, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk, maxGroupTieredPackage, groupedWithMeteredMinimum, matrixWithDisplayName, groupedTieredPackage) /* spotless:on */ override fun toString(): String = when { - newSubscriptionUnit != null -> "Price{newSubscriptionUnit=$newSubscriptionUnit}" - newSubscriptionPackage != null -> - "Price{newSubscriptionPackage=$newSubscriptionPackage}" - newSubscriptionMatrix != null -> - "Price{newSubscriptionMatrix=$newSubscriptionMatrix}" - newSubscriptionTiered != null -> - "Price{newSubscriptionTiered=$newSubscriptionTiered}" - newSubscriptionTieredBps != null -> - "Price{newSubscriptionTieredBps=$newSubscriptionTieredBps}" - newSubscriptionBps != null -> "Price{newSubscriptionBps=$newSubscriptionBps}" - newSubscriptionBulkBps != null -> - "Price{newSubscriptionBulkBps=$newSubscriptionBulkBps}" - newSubscriptionBulk != null -> "Price{newSubscriptionBulk=$newSubscriptionBulk}" - newSubscriptionThresholdTotalAmount != null -> - "Price{newSubscriptionThresholdTotalAmount=$newSubscriptionThresholdTotalAmount}" - newSubscriptionTieredPackage != null -> - "Price{newSubscriptionTieredPackage=$newSubscriptionTieredPackage}" - newSubscriptionTieredWithMinimum != null -> - "Price{newSubscriptionTieredWithMinimum=$newSubscriptionTieredWithMinimum}" - newSubscriptionUnitWithPercent != null -> - "Price{newSubscriptionUnitWithPercent=$newSubscriptionUnitWithPercent}" - newSubscriptionPackageWithAllocation != null -> - "Price{newSubscriptionPackageWithAllocation=$newSubscriptionPackageWithAllocation}" - newSubscriptionTierWithProration != null -> - "Price{newSubscriptionTierWithProration=$newSubscriptionTierWithProration}" - newSubscriptionUnitWithProration != null -> - "Price{newSubscriptionUnitWithProration=$newSubscriptionUnitWithProration}" - newSubscriptionGroupedAllocation != null -> - "Price{newSubscriptionGroupedAllocation=$newSubscriptionGroupedAllocation}" - newSubscriptionGroupedWithProratedMinimum != null -> - "Price{newSubscriptionGroupedWithProratedMinimum=$newSubscriptionGroupedWithProratedMinimum}" - newSubscriptionBulkWithProration != null -> - "Price{newSubscriptionBulkWithProration=$newSubscriptionBulkWithProration}" - newSubscriptionScalableMatrixWithUnitPricing != null -> - "Price{newSubscriptionScalableMatrixWithUnitPricing=$newSubscriptionScalableMatrixWithUnitPricing}" - newSubscriptionScalableMatrixWithTieredPricing != null -> - "Price{newSubscriptionScalableMatrixWithTieredPricing=$newSubscriptionScalableMatrixWithTieredPricing}" - newSubscriptionCumulativeGroupedBulk != null -> - "Price{newSubscriptionCumulativeGroupedBulk=$newSubscriptionCumulativeGroupedBulk}" - newSubscriptionMaxGroupTieredPackage != null -> - "Price{newSubscriptionMaxGroupTieredPackage=$newSubscriptionMaxGroupTieredPackage}" - newSubscriptionGroupedWithMeteredMinimum != null -> - "Price{newSubscriptionGroupedWithMeteredMinimum=$newSubscriptionGroupedWithMeteredMinimum}" - newSubscriptionMatrixWithDisplayName != null -> - "Price{newSubscriptionMatrixWithDisplayName=$newSubscriptionMatrixWithDisplayName}" - newSubscriptionGroupedTieredPackage != null -> - "Price{newSubscriptionGroupedTieredPackage=$newSubscriptionGroupedTieredPackage}" + unit != null -> "Price{unit=$unit}" + package_ != null -> "Price{package_=$package_}" + matrix != null -> "Price{matrix=$matrix}" + tiered != null -> "Price{tiered=$tiered}" + tieredBps != null -> "Price{tieredBps=$tieredBps}" + bps != null -> "Price{bps=$bps}" + bulkBps != null -> "Price{bulkBps=$bulkBps}" + bulk != null -> "Price{bulk=$bulk}" + thresholdTotalAmount != null -> + "Price{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" + tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" + unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" + packageWithAllocation != null -> + "Price{packageWithAllocation=$packageWithAllocation}" + tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" + scalableMatrixWithUnitPricing != null -> + "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" + maxGroupTieredPackage != null -> + "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" + groupedWithMeteredMinimum != null -> + "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Price{matrixWithDisplayName=$matrixWithDisplayName}" + groupedTieredPackage != null -> + "Price{groupedTieredPackage=$groupedTieredPackage}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } companion object { - @JvmStatic - fun ofNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice) = - Price(newSubscriptionUnit = newSubscriptionUnit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofNewSubscriptionPackage(newSubscriptionPackage: NewSubscriptionPackagePrice) = - Price(newSubscriptionPackage = newSubscriptionPackage) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic - fun ofNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice) = - Price(newSubscriptionMatrix = newSubscriptionMatrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) - @JvmStatic - fun ofNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice) = - Price(newSubscriptionTiered = newSubscriptionTiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic - fun ofNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = Price(newSubscriptionTieredBps = newSubscriptionTieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic - fun ofNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice) = - Price(newSubscriptionBps = newSubscriptionBps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic - fun ofNewSubscriptionBulkBps(newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice) = - Price(newSubscriptionBulkBps = newSubscriptionBulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic - fun ofNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice) = - Price(newSubscriptionBulk = newSubscriptionBulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ) = Price(newSubscriptionThresholdTotalAmount = newSubscriptionThresholdTotalAmount) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = Price(newSubscriptionTieredPackage = newSubscriptionTieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = + Price(tieredPackage = tieredPackage) @JvmStatic - fun ofNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = Price(newSubscriptionTieredWithMinimum = newSubscriptionTieredWithMinimum) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = Price(newSubscriptionUnitWithPercent = newSubscriptionUnitWithPercent) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ) = - Price( - newSubscriptionPackageWithAllocation = newSubscriptionPackageWithAllocation - ) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = Price(newSubscriptionTierWithProration = newSubscriptionTierWithProration) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = Price(newSubscriptionUnitWithProration = newSubscriptionUnitWithProration) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Price(unitWithProration = unitWithProration) @JvmStatic - fun ofNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = Price(newSubscriptionGroupedAllocation = newSubscriptionGroupedAllocation) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = - Price( - newSubscriptionGroupedWithProratedMinimum = - newSubscriptionGroupedWithProratedMinimum - ) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = Price(newSubscriptionBulkWithProration = newSubscriptionBulkWithProration) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithUnitPricing = - newSubscriptionScalableMatrixWithUnitPricing - ) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithTieredPricing = - newSubscriptionScalableMatrixWithTieredPricing - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ) = - Price( - newSubscriptionCumulativeGroupedBulk = newSubscriptionCumulativeGroupedBulk - ) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Price(cumulativeGroupedBulk = cumulativeGroupedBulk) @JvmStatic - fun ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ) = - Price( - newSubscriptionMaxGroupTieredPackage = newSubscriptionMaxGroupTieredPackage - ) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - Price( - newSubscriptionGroupedWithMeteredMinimum = - newSubscriptionGroupedWithMeteredMinimum - ) + fun ofGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ) = - Price( - newSubscriptionMatrixWithDisplayName = newSubscriptionMatrixWithDisplayName - ) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ) = Price(newSubscriptionGroupedTieredPackage = newSubscriptionGroupedTieredPackage) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Price(groupedTieredPackage = groupedTieredPackage) } /** @@ -8562,99 +8142,63 @@ private constructor( */ interface Visitor { - fun visitNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ): T + fun visitPackage(package_: Package): T - fun visitNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T - fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -8680,221 +8224,138 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionUnit = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unit = it, _json = json) + } ?: Price(_json = json) } "package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) + } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionMatrix = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrix = it, _json = json) + } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTiered = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tiered = it, _json = json) + } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredBps = it, _json = json) + } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bps = it, _json = json) + } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkBps = it, _json = json) + } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBulk = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulk = it, _json = json) + } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionThresholdTotalAmount = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(thresholdTotalAmount = it, _json = json) } + ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackage = it, _json = json) + } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithMinimum = it, _json = json) + } ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithPercent = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithPercent = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionPackageWithAllocation = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(packageWithAllocation = it, _json = json) } + ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTierWithProration = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(tieredWithProration = it, _json = json) } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionGroupedAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedAllocation = it, _json = json) + } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionGroupedWithProratedMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(groupedWithProratedMinimum = it, _json = json) } + ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkWithProration = it, _json = json) + } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithUnitPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithUnitPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } + ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithTieredPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithTieredPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionCumulativeGroupedBulk = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(cumulativeGroupedBulk = it, _json = json) } + ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMaxGroupTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(maxGroupTieredPackage = it, _json = json) } + ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price( - newSubscriptionGroupedWithMeteredMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } + ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMatrixWithDisplayName = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(matrixWithDisplayName = it, _json = json) } + ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionGroupedTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedTieredPackage = it, _json = json) } + ?: Price(_json = json) } } @@ -8910,67 +8371,54 @@ private constructor( provider: SerializerProvider, ) { when { - value.newSubscriptionUnit != null -> - generator.writeObject(value.newSubscriptionUnit) - value.newSubscriptionPackage != null -> - generator.writeObject(value.newSubscriptionPackage) - value.newSubscriptionMatrix != null -> - generator.writeObject(value.newSubscriptionMatrix) - value.newSubscriptionTiered != null -> - generator.writeObject(value.newSubscriptionTiered) - value.newSubscriptionTieredBps != null -> - generator.writeObject(value.newSubscriptionTieredBps) - value.newSubscriptionBps != null -> - generator.writeObject(value.newSubscriptionBps) - value.newSubscriptionBulkBps != null -> - generator.writeObject(value.newSubscriptionBulkBps) - value.newSubscriptionBulk != null -> - generator.writeObject(value.newSubscriptionBulk) - value.newSubscriptionThresholdTotalAmount != null -> - generator.writeObject(value.newSubscriptionThresholdTotalAmount) - value.newSubscriptionTieredPackage != null -> - generator.writeObject(value.newSubscriptionTieredPackage) - value.newSubscriptionTieredWithMinimum != null -> - generator.writeObject(value.newSubscriptionTieredWithMinimum) - value.newSubscriptionUnitWithPercent != null -> - generator.writeObject(value.newSubscriptionUnitWithPercent) - value.newSubscriptionPackageWithAllocation != null -> - generator.writeObject(value.newSubscriptionPackageWithAllocation) - value.newSubscriptionTierWithProration != null -> - generator.writeObject(value.newSubscriptionTierWithProration) - value.newSubscriptionUnitWithProration != null -> - generator.writeObject(value.newSubscriptionUnitWithProration) - value.newSubscriptionGroupedAllocation != null -> - generator.writeObject(value.newSubscriptionGroupedAllocation) - value.newSubscriptionGroupedWithProratedMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithProratedMinimum) - value.newSubscriptionBulkWithProration != null -> - generator.writeObject(value.newSubscriptionBulkWithProration) - value.newSubscriptionScalableMatrixWithUnitPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithUnitPricing - ) - value.newSubscriptionScalableMatrixWithTieredPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithTieredPricing - ) - value.newSubscriptionCumulativeGroupedBulk != null -> - generator.writeObject(value.newSubscriptionCumulativeGroupedBulk) - value.newSubscriptionMaxGroupTieredPackage != null -> - generator.writeObject(value.newSubscriptionMaxGroupTieredPackage) - value.newSubscriptionGroupedWithMeteredMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithMeteredMinimum) - value.newSubscriptionMatrixWithDisplayName != null -> - generator.writeObject(value.newSubscriptionMatrixWithDisplayName) - value.newSubscriptionGroupedTieredPackage != null -> - generator.writeObject(value.newSubscriptionGroupedTieredPackage) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.unitWithPercent != null -> + generator.writeObject(value.unitWithPercent) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } } } - class NewSubscriptionUnitPrice + class Unit private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -9376,8 +8824,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -9390,7 +8837,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -9415,27 +8862,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - cadence = newSubscriptionUnitPrice.cadence - itemId = newSubscriptionUnitPrice.itemId - modelType = newSubscriptionUnitPrice.modelType - name = newSubscriptionUnitPrice.name - unitConfig = newSubscriptionUnitPrice.unitConfig - billableMetricId = newSubscriptionUnitPrice.billableMetricId - billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitPrice.conversionRate - 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() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + currency = unit.currency + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + referenceId = unit.referenceId + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -9808,7 +9252,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9822,8 +9266,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitPrice = - NewSubscriptionUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -9846,7 +9290,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -11075,7 +10519,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -11085,10 +10529,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewSubscriptionPackagePrice + class Package private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -11494,8 +10938,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -11508,7 +10951,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -11533,29 +10976,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = - apply { - cadence = newSubscriptionPackagePrice.cadence - itemId = newSubscriptionPackagePrice.itemId - modelType = newSubscriptionPackagePrice.modelType - name = newSubscriptionPackagePrice.name - packageConfig = newSubscriptionPackagePrice.packageConfig - billableMetricId = newSubscriptionPackagePrice.billableMetricId - billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionPackagePrice.conversionRate - 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() - } + internal fun from(package_: Package) = apply { + cadence = package_.cadence + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + currency = package_.currency + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + referenceId = package_.referenceId + additionalProperties = package_.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -11928,7 +11367,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11942,8 +11381,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackagePrice = - NewSubscriptionPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -11966,7 +11405,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -13246,7 +12685,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -13256,10 +12695,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewSubscriptionMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -13665,8 +13104,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -13679,7 +13117,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -13704,29 +13142,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = - apply { - cadence = newSubscriptionMatrixPrice.cadence - itemId = newSubscriptionMatrixPrice.itemId - matrixConfig = newSubscriptionMatrixPrice.matrixConfig - modelType = newSubscriptionMatrixPrice.modelType - name = newSubscriptionMatrixPrice.name - billableMetricId = newSubscriptionMatrixPrice.billableMetricId - billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixPrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixPrice.conversionRate - 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() - } + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + currency = matrix.currency + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + referenceId = matrix.referenceId + additionalProperties = matrix.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -14099,7 +13533,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -14113,8 +13547,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixPrice = - NewSubscriptionMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), @@ -14137,7 +13571,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -15740,7 +15174,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -15750,10 +15184,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewSubscriptionTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -16159,8 +15593,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -16173,7 +15606,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -16198,29 +15631,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = - apply { - cadence = newSubscriptionTieredPrice.cadence - itemId = newSubscriptionTieredPrice.itemId - modelType = newSubscriptionTieredPrice.modelType - name = newSubscriptionTieredPrice.name - tieredConfig = newSubscriptionTieredPrice.tieredConfig - billableMetricId = newSubscriptionTieredPrice.billableMetricId - billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPrice.conversionRate - 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() - } + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + currency = tiered.currency + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + referenceId = tiered.referenceId + additionalProperties = tiered.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -16593,7 +16022,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -16607,8 +16036,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPrice = - NewSubscriptionTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -16631,7 +16060,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -18152,7 +17581,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -18162,10 +17591,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewSubscriptionTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -18572,8 +18001,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -18586,7 +18014,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -18611,29 +18039,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice - ) = apply { - cadence = newSubscriptionTieredBpsPrice.cadence - itemId = newSubscriptionTieredBpsPrice.itemId - modelType = newSubscriptionTieredBpsPrice.modelType - name = newSubscriptionTieredBpsPrice.name - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig - billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredBpsPrice.conversionRate - 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() + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + currency = tieredBps.currency + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + referenceId = tieredBps.referenceId + additionalProperties = tieredBps.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -19007,7 +18430,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -19021,8 +18444,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredBpsPrice = - NewSubscriptionTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -19045,7 +18468,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -20608,7 +20031,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -20618,10 +20041,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewSubscriptionBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -21027,8 +20450,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -21041,7 +20463,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -21066,27 +20488,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - bpsConfig = newSubscriptionBpsPrice.bpsConfig - cadence = newSubscriptionBpsPrice.cadence - itemId = newSubscriptionBpsPrice.itemId - modelType = newSubscriptionBpsPrice.modelType - name = newSubscriptionBpsPrice.name - billableMetricId = newSubscriptionBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBpsPrice.conversionRate - 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() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + currency = bps.currency + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + referenceId = bps.referenceId + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -21459,7 +20878,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -21473,8 +20892,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBpsPrice = - NewSubscriptionBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -21497,7 +20916,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -22773,7 +22192,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -22783,10 +22202,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewSubscriptionBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -23192,8 +22611,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -23206,7 +22624,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -23231,29 +22649,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = - apply { - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig - cadence = newSubscriptionBulkBpsPrice.cadence - itemId = newSubscriptionBulkBpsPrice.itemId - modelType = newSubscriptionBulkBpsPrice.modelType - name = newSubscriptionBulkBpsPrice.name - billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkBpsPrice.conversionRate - 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() - } + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + currency = bulkBps.currency + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + referenceId = bulkBps.referenceId + additionalProperties = bulkBps.additionalProperties.toMutableMap() + } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = bulkBpsConfig(JsonField.of(bulkBpsConfig)) @@ -23626,7 +23040,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -23640,8 +23054,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkBpsPrice = - NewSubscriptionBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -23664,7 +23078,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -25181,7 +24595,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -25191,10 +24605,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewSubscriptionBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -25600,8 +25014,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -25614,7 +25027,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -25639,27 +25052,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - bulkConfig = newSubscriptionBulkPrice.bulkConfig - cadence = newSubscriptionBulkPrice.cadence - itemId = newSubscriptionBulkPrice.itemId - modelType = newSubscriptionBulkPrice.modelType - name = newSubscriptionBulkPrice.name - billableMetricId = newSubscriptionBulkPrice.billableMetricId - billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkPrice.conversionRate - 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() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + currency = bulk.currency + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + referenceId = bulk.referenceId + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -26032,7 +25442,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -26046,8 +25456,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkPrice = - NewSubscriptionBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -26070,7 +25480,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -27545,7 +26955,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -27555,10 +26965,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewSubscriptionThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -27968,7 +27378,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionThresholdTotalAmountPrice]. + * [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -27981,7 +27391,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -28007,34 +27417,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionThresholdTotalAmountPrice: - NewSubscriptionThresholdTotalAmountPrice - ) = apply { - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - itemId = newSubscriptionThresholdTotalAmountPrice.itemId - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - name = newSubscriptionThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - currency = newSubscriptionThresholdTotalAmountPrice.currency - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + currency = thresholdTotalAmount.currency + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId + thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata + referenceId = thresholdTotalAmount.referenceId additionalProperties = - newSubscriptionThresholdTotalAmountPrice.additionalProperties - .toMutableMap() + thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -28410,7 +27812,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -28424,8 +27826,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionThresholdTotalAmountPrice = - NewSubscriptionThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -28448,7 +27850,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -29622,7 +29024,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -29632,10 +29034,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewSubscriptionTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -30042,8 +29444,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -30056,7 +29457,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -30081,29 +29482,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice - ) = apply { - cadence = newSubscriptionTieredPackagePrice.cadence - itemId = newSubscriptionTieredPackagePrice.itemId - modelType = newSubscriptionTieredPackagePrice.modelType - name = newSubscriptionTieredPackagePrice.name - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig - billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPackagePrice.conversionRate - 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() + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + currency = tieredPackage.currency + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + referenceId = tieredPackage.referenceId + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -30478,7 +29874,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -30492,8 +29888,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPackagePrice = - NewSubscriptionTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -30516,7 +29912,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -31687,7 +31083,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -31697,10 +31093,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewSubscriptionTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -32109,7 +31505,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredWithMinimumPrice]. + * [TieredWithMinimum]. * * The following fields are required: * ```java @@ -32122,7 +31518,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -32147,33 +31543,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice - ) = apply { - cadence = newSubscriptionTieredWithMinimumPrice.cadence - itemId = newSubscriptionTieredWithMinimumPrice.itemId - modelType = newSubscriptionTieredWithMinimumPrice.modelType - name = newSubscriptionTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - currency = newSubscriptionTieredWithMinimumPrice.currency - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newSubscriptionTieredWithMinimumPrice.metadata - referenceId = newSubscriptionTieredWithMinimumPrice.referenceId - additionalProperties = - newSubscriptionTieredWithMinimumPrice.additionalProperties - .toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + currency = tieredWithMinimum.currency + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + referenceId = tieredWithMinimum.referenceId + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -32547,7 +31934,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -32561,8 +31948,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredWithMinimumPrice = - NewSubscriptionTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -32585,7 +31972,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -33759,7 +33146,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -33769,10 +33156,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewSubscriptionUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -34180,8 +33567,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -34194,7 +33580,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -34219,30 +33605,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice - ) = apply { - cadence = newSubscriptionUnitWithPercentPrice.cadence - itemId = newSubscriptionUnitWithPercentPrice.itemId - modelType = newSubscriptionUnitWithPercentPrice.modelType - name = newSubscriptionUnitWithPercentPrice.name - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig - billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - 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() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + currency = unitWithPercent.currency + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + referenceId = unitWithPercent.referenceId + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -34616,7 +33996,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -34630,8 +34010,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithPercentPrice = - NewSubscriptionUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -34654,7 +34034,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -35825,7 +35205,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -35835,10 +35215,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewSubscriptionPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -36248,7 +35628,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -36261,7 +35641,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -36288,35 +35668,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionPackageWithAllocationPrice: - NewSubscriptionPackageWithAllocationPrice - ) = apply { - cadence = newSubscriptionPackageWithAllocationPrice.cadence - itemId = newSubscriptionPackageWithAllocationPrice.itemId - modelType = newSubscriptionPackageWithAllocationPrice.modelType - name = newSubscriptionPackageWithAllocationPrice.name + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = - newSubscriptionPackageWithAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - currency = newSubscriptionPackageWithAllocationPrice.currency - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey + packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + currency = packageWithAllocation.currency + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionPackageWithAllocationPrice.metadata - referenceId = newSubscriptionPackageWithAllocationPrice.referenceId + packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata + referenceId = packageWithAllocation.referenceId additionalProperties = - newSubscriptionPackageWithAllocationPrice.additionalProperties - .toMutableMap() + packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -36692,7 +36064,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -36706,8 +36078,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackageWithAllocationPrice = - NewSubscriptionPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -36733,7 +36105,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -37908,7 +37280,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -37918,10 +37290,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewSubscriptionTierWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -38331,7 +37703,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTierWithProrationPrice]. + * [TieredWithProration]. * * The following fields are required: * ```java @@ -38344,7 +37716,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTierWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -38370,33 +37742,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice - ) = apply { - cadence = newSubscriptionTierWithProrationPrice.cadence - itemId = newSubscriptionTierWithProrationPrice.itemId - modelType = newSubscriptionTierWithProrationPrice.modelType - name = newSubscriptionTierWithProrationPrice.name - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - currency = newSubscriptionTierWithProrationPrice.currency - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTierWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTierWithProrationPrice.invoiceGroupingKey + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + currency = tieredWithProration.currency + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionTierWithProrationPrice.metadata - referenceId = newSubscriptionTierWithProrationPrice.referenceId + tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata + referenceId = tieredWithProration.referenceId additionalProperties = - newSubscriptionTierWithProrationPrice.additionalProperties - .toMutableMap() + tieredWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -38771,7 +38136,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTierWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -38785,8 +38150,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTierWithProrationPrice = - NewSubscriptionTierWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -38809,7 +38174,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTierWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -39983,7 +39348,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -39993,10 +39358,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewSubscriptionUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -40405,7 +39770,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithProrationPrice]. + * [UnitWithProration]. * * The following fields are required: * ```java @@ -40418,7 +39783,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -40443,33 +39808,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice - ) = apply { - cadence = newSubscriptionUnitWithProrationPrice.cadence - itemId = newSubscriptionUnitWithProrationPrice.itemId - modelType = newSubscriptionUnitWithProrationPrice.modelType - name = newSubscriptionUnitWithProrationPrice.name - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - currency = newSubscriptionUnitWithProrationPrice.currency - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionUnitWithProrationPrice.metadata - referenceId = newSubscriptionUnitWithProrationPrice.referenceId - additionalProperties = - newSubscriptionUnitWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + currency = unitWithProration.currency + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + referenceId = unitWithProration.referenceId + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -40843,7 +40199,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -40857,8 +40213,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithProrationPrice = - NewSubscriptionUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -40881,7 +40237,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -42055,7 +41411,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -42065,10 +41421,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewSubscriptionGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, @@ -42477,7 +41833,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedAllocationPrice]. + * [GroupedAllocation]. * * The following fields are required: * ```java @@ -42490,7 +41846,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -42515,33 +41871,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice - ) = apply { - cadence = newSubscriptionGroupedAllocationPrice.cadence - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - itemId = newSubscriptionGroupedAllocationPrice.itemId - modelType = newSubscriptionGroupedAllocationPrice.modelType - name = newSubscriptionGroupedAllocationPrice.name - billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - currency = newSubscriptionGroupedAllocationPrice.currency - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedAllocationPrice.metadata - referenceId = newSubscriptionGroupedAllocationPrice.referenceId - additionalProperties = - newSubscriptionGroupedAllocationPrice.additionalProperties - .toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + currency = groupedAllocation.currency + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + referenceId = groupedAllocation.referenceId + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -42915,7 +42262,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -42929,8 +42276,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedAllocationPrice = - NewSubscriptionGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), @@ -42953,7 +42300,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -44125,7 +43472,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -44135,10 +43482,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewSubscriptionGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val groupedWithProratedMinimumConfig: @@ -44551,7 +43898,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -44564,7 +43911,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -44592,41 +43939,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithProratedMinimumPrice: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - name = newSubscriptionGroupedWithProratedMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = + apply { + cadence = groupedWithProratedMinimum.cadence + groupedWithProratedMinimumConfig = + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + currency = groupedWithProratedMinimum.currency + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata + referenceId = groupedWithProratedMinimum.referenceId + additionalProperties = + groupedWithProratedMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -45007,8 +44343,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -45022,8 +44357,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = - NewSubscriptionGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", @@ -45049,7 +44384,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -46224,7 +45559,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -46234,10 +45569,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewSubscriptionBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -46646,7 +45981,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkWithProrationPrice]. + * [BulkWithProration]. * * The following fields are required: * ```java @@ -46659,7 +45994,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -46684,33 +46019,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice - ) = apply { - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - cadence = newSubscriptionBulkWithProrationPrice.cadence - itemId = newSubscriptionBulkWithProrationPrice.itemId - modelType = newSubscriptionBulkWithProrationPrice.modelType - name = newSubscriptionBulkWithProrationPrice.name - billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - currency = newSubscriptionBulkWithProrationPrice.currency - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionBulkWithProrationPrice.metadata - referenceId = newSubscriptionBulkWithProrationPrice.referenceId - additionalProperties = - newSubscriptionBulkWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + currency = bulkWithProration.currency + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + referenceId = bulkWithProration.referenceId + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = @@ -47084,7 +46410,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -47098,8 +46424,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkWithProrationPrice = - NewSubscriptionBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -47122,7 +46448,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -48296,7 +47622,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -48306,10 +47632,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewSubscriptionScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -48724,7 +48050,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -48737,7 +48063,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -48766,40 +48092,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithUnitPricingPrice: - NewSubscriptionScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithUnitPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithUnitPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithUnitPricingPrice.modelType - name = newSubscriptionScalableMatrixWithUnitPricingPrice.name + cadence = scalableMatrixWithUnitPricing.cadence + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name scalableMatrixWithUnitPricingConfig = - newSubscriptionScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithUnitPricingPrice.billedInAdvance + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithUnitPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithUnitPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithUnitPricingPrice.invoiceGroupingKey + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + currency = scalableMatrixWithUnitPricing.currency + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithUnitPricingPrice.metadata - referenceId = newSubscriptionScalableMatrixWithUnitPricingPrice.referenceId + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata + referenceId = scalableMatrixWithUnitPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -49183,8 +48498,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -49198,8 +48512,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithUnitPricingPrice = - NewSubscriptionScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -49225,7 +48539,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -50402,7 +49716,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -50412,10 +49726,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -50830,7 +50144,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -50843,7 +50157,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -50872,41 +50186,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithTieredPricingPrice: - NewSubscriptionScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithTieredPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithTieredPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithTieredPricingPrice.modelType - name = newSubscriptionScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newSubscriptionScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithTieredPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithTieredPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + currency = scalableMatrixWithTieredPricing.currency + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithTieredPricingPrice.metadata - referenceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.referenceId + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata + referenceId = scalableMatrixWithTieredPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -51290,8 +50592,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -51305,8 +50606,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithTieredPricingPrice = - NewSubscriptionScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -51332,7 +50633,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -52513,7 +51814,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -52523,10 +51824,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -52936,7 +52237,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -52949,7 +52250,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -52976,35 +52277,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionCumulativeGroupedBulkPrice: - NewSubscriptionCumulativeGroupedBulkPrice - ) = apply { - cadence = newSubscriptionCumulativeGroupedBulkPrice.cadence + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence cumulativeGroupedBulkConfig = - newSubscriptionCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - itemId = newSubscriptionCumulativeGroupedBulkPrice.itemId - modelType = newSubscriptionCumulativeGroupedBulkPrice.modelType - name = newSubscriptionCumulativeGroupedBulkPrice.name - billableMetricId = - newSubscriptionCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newSubscriptionCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionCumulativeGroupedBulkPrice.conversionRate - currency = newSubscriptionCumulativeGroupedBulkPrice.currency - externalPriceId = newSubscriptionCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionCumulativeGroupedBulkPrice.invoiceGroupingKey + cumulativeGroupedBulk.cumulativeGroupedBulkConfig + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + currency = cumulativeGroupedBulk.currency + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newSubscriptionCumulativeGroupedBulkPrice.metadata - referenceId = newSubscriptionCumulativeGroupedBulkPrice.referenceId + cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata + referenceId = cumulativeGroupedBulk.referenceId additionalProperties = - newSubscriptionCumulativeGroupedBulkPrice.additionalProperties - .toMutableMap() + cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -53380,7 +52673,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -53394,8 +52687,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionCumulativeGroupedBulkPrice = - NewSubscriptionCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired( "cumulativeGroupedBulkConfig", @@ -53421,7 +52714,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -54596,7 +53889,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -54606,10 +53899,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" } - class NewSubscriptionMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -55019,7 +54312,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -55032,7 +54325,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -55059,35 +54352,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMaxGroupTieredPackagePrice: - NewSubscriptionMaxGroupTieredPackagePrice - ) = apply { - cadence = newSubscriptionMaxGroupTieredPackagePrice.cadence - itemId = newSubscriptionMaxGroupTieredPackagePrice.itemId + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + itemId = maxGroupTieredPackage.itemId maxGroupTieredPackageConfig = - newSubscriptionMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newSubscriptionMaxGroupTieredPackagePrice.modelType - name = newSubscriptionMaxGroupTieredPackagePrice.name - billableMetricId = - newSubscriptionMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionMaxGroupTieredPackagePrice.conversionRate - currency = newSubscriptionMaxGroupTieredPackagePrice.currency - externalPriceId = newSubscriptionMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMaxGroupTieredPackagePrice.invoiceGroupingKey + maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + currency = maxGroupTieredPackage.currency + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionMaxGroupTieredPackagePrice.metadata - referenceId = newSubscriptionMaxGroupTieredPackagePrice.referenceId + maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata + referenceId = maxGroupTieredPackage.referenceId additionalProperties = - newSubscriptionMaxGroupTieredPackagePrice.additionalProperties - .toMutableMap() + maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -55463,7 +54748,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -55477,8 +54762,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMaxGroupTieredPackagePrice = - NewSubscriptionMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -55504,7 +54789,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -56679,7 +55964,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -56689,10 +55974,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" + "MaxGroupTieredPackage{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" } - class NewSubscriptionGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val groupedWithMeteredMinimumConfig: @@ -57105,7 +56390,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -57118,7 +56403,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -57146,41 +56431,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithMeteredMinimumPrice: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithMeteredMinimumPrice.cadence - groupedWithMeteredMinimumConfig = - newSubscriptionGroupedWithMeteredMinimumPrice - .groupedWithMeteredMinimumConfig - itemId = newSubscriptionGroupedWithMeteredMinimumPrice.itemId - modelType = newSubscriptionGroupedWithMeteredMinimumPrice.modelType - name = newSubscriptionGroupedWithMeteredMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithMeteredMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithMeteredMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithMeteredMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithMeteredMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithMeteredMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithMeteredMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + apply { + cadence = groupedWithMeteredMinimum.cadence + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + currency = groupedWithMeteredMinimum.currency + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata + referenceId = groupedWithMeteredMinimum.referenceId + additionalProperties = + groupedWithMeteredMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -57560,8 +56834,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -57575,8 +56848,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithMeteredMinimumPrice = - NewSubscriptionGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithMeteredMinimumConfig", @@ -57602,7 +56875,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -58777,7 +58050,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithMeteredMinimumPrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -58787,10 +58060,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithMeteredMinimumPrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimum{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -59200,7 +58473,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -59213,7 +58486,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -59240,35 +58513,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMatrixWithDisplayNamePrice: - NewSubscriptionMatrixWithDisplayNamePrice - ) = apply { - cadence = newSubscriptionMatrixWithDisplayNamePrice.cadence - itemId = newSubscriptionMatrixWithDisplayNamePrice.itemId + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + itemId = matrixWithDisplayName.itemId matrixWithDisplayNameConfig = - newSubscriptionMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newSubscriptionMatrixWithDisplayNamePrice.modelType - name = newSubscriptionMatrixWithDisplayNamePrice.name - billableMetricId = - newSubscriptionMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newSubscriptionMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixWithDisplayNamePrice.conversionRate - currency = newSubscriptionMatrixWithDisplayNamePrice.currency - externalPriceId = newSubscriptionMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMatrixWithDisplayNamePrice.invoiceGroupingKey + matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + currency = matrixWithDisplayName.currency + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newSubscriptionMatrixWithDisplayNamePrice.metadata - referenceId = newSubscriptionMatrixWithDisplayNamePrice.referenceId + matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata + referenceId = matrixWithDisplayName.referenceId additionalProperties = - newSubscriptionMatrixWithDisplayNamePrice.additionalProperties - .toMutableMap() + matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -59644,7 +58909,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -59658,8 +58923,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixWithDisplayNamePrice = - NewSubscriptionMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -59685,7 +58950,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -60860,7 +60125,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixWithDisplayNamePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -60870,10 +60135,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixWithDisplayNamePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "MatrixWithDisplayName{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, @@ -61283,7 +60548,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedTieredPackagePrice]. + * [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -61296,7 +60561,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -61322,34 +60587,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedTieredPackagePrice: - NewSubscriptionGroupedTieredPackagePrice - ) = apply { - cadence = newSubscriptionGroupedTieredPackagePrice.cadence - groupedTieredPackageConfig = - newSubscriptionGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newSubscriptionGroupedTieredPackagePrice.itemId - modelType = newSubscriptionGroupedTieredPackagePrice.modelType - name = newSubscriptionGroupedTieredPackagePrice.name - billableMetricId = newSubscriptionGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedTieredPackagePrice.conversionRate - currency = newSubscriptionGroupedTieredPackagePrice.currency - externalPriceId = newSubscriptionGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedTieredPackagePrice.invoiceGroupingKey + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + currency = groupedTieredPackage.currency + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedTieredPackagePrice.metadata - referenceId = newSubscriptionGroupedTieredPackagePrice.referenceId + groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata + referenceId = groupedTieredPackage.referenceId additionalProperties = - newSubscriptionGroupedTieredPackagePrice.additionalProperties - .toMutableMap() + groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -61725,7 +60982,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -61739,8 +60996,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedTieredPackagePrice = - NewSubscriptionGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), @@ -61763,7 +61020,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -62937,7 +62194,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedTieredPackagePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackage && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -62947,7 +62204,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedTieredPackagePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedTieredPackage{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } @@ -63944,32 +63201,26 @@ private constructor( /** * Alias for calling [adjustment] with - * `Adjustment.ofNewPercentageDiscount(newPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = - adjustment(Adjustment.ofNewPercentageDiscount(newPercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewUsageDiscount(newUsageDiscount)`. - */ - fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = - adjustment(Adjustment.ofNewUsageDiscount(newUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewAmountDiscount(newAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = - adjustment(Adjustment.ofNewAmountDiscount(newAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMinimum(newMinimum)`. */ - fun adjustment(newMinimum: Adjustment.NewMinimum) = - adjustment(Adjustment.ofNewMinimum(newMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMaximum(newMaximum)`. */ - fun adjustment(newMaximum: Adjustment.NewMaximum) = - adjustment(Adjustment.ofNewMaximum(newMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The id of the adjustment on the plan to replace in the subscription. */ fun replacesAdjustmentId(replacesAdjustmentId: String) = @@ -64062,60 +63313,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val newPercentageDiscount: NewPercentageDiscount? = null, - private val newUsageDiscount: NewUsageDiscount? = null, - private val newAmountDiscount: NewAmountDiscount? = null, - private val newMinimum: NewMinimum? = null, - private val newMaximum: NewMaximum? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun newPercentageDiscount(): Optional = - Optional.ofNullable(newPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun newUsageDiscount(): Optional = - Optional.ofNullable(newUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun newAmountDiscount(): Optional = - Optional.ofNullable(newAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun newMinimum(): Optional = Optional.ofNullable(newMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun newMaximum(): Optional = Optional.ofNullable(newMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isNewPercentageDiscount(): Boolean = newPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isNewUsageDiscount(): Boolean = newUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isNewAmountDiscount(): Boolean = newAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isNewMinimum(): Boolean = newMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isNewMaximum(): Boolean = newMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asNewPercentageDiscount(): NewPercentageDiscount = - newPercentageDiscount.getOrThrow("newPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asNewUsageDiscount(): NewUsageDiscount = - newUsageDiscount.getOrThrow("newUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asNewAmountDiscount(): NewAmountDiscount = - newAmountDiscount.getOrThrow("newAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asNewMinimum(): NewMinimum = newMinimum.getOrThrow("newMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asNewMaximum(): NewMaximum = newMaximum.getOrThrow("newMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newPercentageDiscount != null -> - visitor.visitNewPercentageDiscount(newPercentageDiscount) - newUsageDiscount != null -> visitor.visitNewUsageDiscount(newUsageDiscount) - newAmountDiscount != null -> visitor.visitNewAmountDiscount(newAmountDiscount) - newMinimum != null -> visitor.visitNewMinimum(newMinimum) - newMaximum != null -> visitor.visitNewMaximum(newMaximum) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -64128,26 +63375,26 @@ private constructor( accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - newPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) { - newUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) { - newAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitNewMinimum(newMinimum: NewMinimum) { - newMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitNewMaximum(newMaximum: NewMaximum) { - newMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -64172,19 +63419,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount - ) = newPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - newUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - newAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitNewMinimum(newMinimum: NewMinimum) = newMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitNewMaximum(newMaximum: NewMaximum) = newMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -64195,19 +63442,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && newPercentageDiscount == other.newPercentageDiscount && newUsageDiscount == other.newUsageDiscount && newAmountDiscount == other.newAmountDiscount && newMinimum == other.newMinimum && newMaximum == other.newMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPercentageDiscount, newUsageDiscount, newAmountDiscount, newMinimum, newMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentageDiscount, usageDiscount, amountDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - newPercentageDiscount != null -> - "Adjustment{newPercentageDiscount=$newPercentageDiscount}" - newUsageDiscount != null -> "Adjustment{newUsageDiscount=$newUsageDiscount}" - newAmountDiscount != null -> "Adjustment{newAmountDiscount=$newAmountDiscount}" - newMinimum != null -> "Adjustment{newMinimum=$newMinimum}" - newMaximum != null -> "Adjustment{newMaximum=$newMaximum}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -64215,22 +63462,20 @@ private constructor( companion object { @JvmStatic - fun ofNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount) = - Adjustment(newPercentageDiscount = newPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) @JvmStatic - fun ofNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - Adjustment(newUsageDiscount = newUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - Adjustment(newAmountDiscount = newAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) - @JvmStatic - fun ofNewMinimum(newMinimum: NewMinimum) = Adjustment(newMinimum = newMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofNewMaximum(newMaximum: NewMaximum) = Adjustment(newMaximum = newMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -64239,15 +63484,15 @@ private constructor( */ interface Visitor { - fun visitNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitNewMinimum(newMinimum: NewMinimum): T + fun visitMinimum(minimum: Minimum): T - fun visitNewMaximum(newMaximum: NewMaximum): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -64273,28 +63518,28 @@ private constructor( when (adjustmentType) { "percentage_discount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(newPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "usage_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newUsageDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newAmountDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMinimum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMaximum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) } ?: Adjustment(_json = json) } } @@ -64311,21 +63556,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.newPercentageDiscount != null -> - generator.writeObject(value.newPercentageDiscount) - value.newUsageDiscount != null -> - generator.writeObject(value.newUsageDiscount) - value.newAmountDiscount != null -> - generator.writeObject(value.newAmountDiscount) - value.newMinimum != null -> generator.writeObject(value.newMinimum) - value.newMaximum != null -> generator.writeObject(value.newMaximum) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class NewPercentageDiscount + class PercentageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -64443,7 +63686,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPercentageDiscount]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -64454,7 +63697,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPercentageDiscount]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") @@ -64464,14 +63707,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - adjustmentType = newPercentageDiscount.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - newPercentageDiscount.appliesToPriceIds.map { it.toMutableList() } - percentageDiscount = newPercentageDiscount.percentageDiscount - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.percentageDiscount = percentageDiscount.percentageDiscount + isInvoiceLevel = percentageDiscount.isInvoiceLevel additionalProperties = - newPercentageDiscount.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } /** @@ -64572,7 +63815,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPercentageDiscount]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -64584,8 +63827,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPercentageDiscount = - NewPercentageDiscount( + fun build(): PercentageDiscount = + PercentageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -64598,7 +63841,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPercentageDiscount = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -64644,7 +63887,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -64654,10 +63897,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "PercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewUsageDiscount + class UsageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -64773,7 +64016,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewUsageDiscount]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -64784,7 +64027,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewUsageDiscount]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("usage_discount") @@ -64794,13 +64037,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - adjustmentType = newUsageDiscount.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - newUsageDiscount.appliesToPriceIds.map { it.toMutableList() } - usageDiscount = newUsageDiscount.usageDiscount - isInvoiceLevel = newUsageDiscount.isInvoiceLevel - additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.usageDiscount = usageDiscount.usageDiscount + isInvoiceLevel = usageDiscount.isInvoiceLevel + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } /** @@ -64901,7 +64144,7 @@ private constructor( } /** - * Returns an immutable instance of [NewUsageDiscount]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -64913,8 +64156,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewUsageDiscount = - NewUsageDiscount( + fun build(): UsageDiscount = + UsageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -64927,7 +64170,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewUsageDiscount = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -64971,7 +64214,7 @@ private constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -64981,10 +64224,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "UsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewAmountDiscount + class AmountDiscount private constructor( private val adjustmentType: JsonValue, private val amountDiscount: JsonField, @@ -65100,8 +64343,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAmountDiscount]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -65112,7 +64354,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAmountDiscount]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("amount_discount") @@ -65122,13 +64364,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - adjustmentType = newAmountDiscount.adjustmentType - amountDiscount = newAmountDiscount.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - newAmountDiscount.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = newAmountDiscount.isInvoiceLevel - additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } /** @@ -65229,7 +64471,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAmountDiscount]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65241,8 +64483,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAmountDiscount = - NewAmountDiscount( + fun build(): AmountDiscount = + AmountDiscount( adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -65255,7 +64497,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAmountDiscount = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -65299,7 +64541,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65309,10 +64551,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "AmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMinimum + class Minimum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -65450,7 +64692,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMinimum]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -65462,7 +64704,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMinimum]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("minimum") @@ -65473,13 +64715,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMinimum: NewMinimum) = apply { - adjustmentType = newMinimum.adjustmentType - appliesToPriceIds = newMinimum.appliesToPriceIds.map { it.toMutableList() } - itemId = newMinimum.itemId - minimumAmount = newMinimum.minimumAmount - isInvoiceLevel = newMinimum.isInvoiceLevel - additionalProperties = newMinimum.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + isInvoiceLevel = minimum.isInvoiceLevel + additionalProperties = minimum.additionalProperties.toMutableMap() } /** @@ -65592,7 +64834,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMinimum]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65605,8 +64847,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMinimum = - NewMinimum( + fun build(): Minimum = + Minimum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -65620,7 +64862,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMinimum = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -65666,7 +64908,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Minimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65676,10 +64918,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Minimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMaximum + class Maximum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -65795,7 +65037,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMaximum]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -65806,7 +65048,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMaximum]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("maximum") @@ -65816,12 +65058,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMaximum: NewMaximum) = apply { - adjustmentType = newMaximum.adjustmentType - appliesToPriceIds = newMaximum.appliesToPriceIds.map { it.toMutableList() } - maximumAmount = newMaximum.maximumAmount - isInvoiceLevel = newMaximum.isInvoiceLevel - additionalProperties = newMaximum.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + maximumAmount = maximum.maximumAmount + isInvoiceLevel = maximum.isInvoiceLevel + additionalProperties = maximum.additionalProperties.toMutableMap() } /** @@ -65922,7 +65164,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMaximum]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65934,8 +65176,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMaximum = - NewMaximum( + fun build(): Maximum = + Maximum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -65948,7 +65190,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMaximum = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -65992,7 +65234,7 @@ private constructor( return true } - return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -66002,7 +65244,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Maximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -66479,244 +65721,127 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** - * Alias for calling [price] with `Price.ofNewSubscriptionUnit(newSubscriptionUnit)`. - */ - fun price(newSubscriptionUnit: Price.NewSubscriptionUnitPrice) = - price(Price.ofNewSubscriptionUnit(newSubscriptionUnit)) + /** Alias for calling [price] with `Price.ofUnit(unit)`. */ + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionPackage(newSubscriptionPackage)`. - */ - fun price(newSubscriptionPackage: Price.NewSubscriptionPackagePrice) = - price(Price.ofNewSubscriptionPackage(newSubscriptionPackage)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)`. - */ - fun price(newSubscriptionMatrix: Price.NewSubscriptionMatrixPrice) = - price(Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)) + /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTiered(newSubscriptionTiered)`. - */ - fun price(newSubscriptionTiered: Price.NewSubscriptionTieredPrice) = - price(Price.ofNewSubscriptionTiered(newSubscriptionTiered)) + /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)`. - */ - fun price(newSubscriptionTieredBps: Price.NewSubscriptionTieredBpsPrice) = - price(Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)) + /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) - /** Alias for calling [price] with `Price.ofNewSubscriptionBps(newSubscriptionBps)`. */ - fun price(newSubscriptionBps: Price.NewSubscriptionBpsPrice) = - price(Price.ofNewSubscriptionBps(newSubscriptionBps)) + /** Alias for calling [price] with `Price.ofBps(bps)`. */ + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)`. - */ - fun price(newSubscriptionBulkBps: Price.NewSubscriptionBulkBpsPrice) = - price(Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)) + /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) - /** - * Alias for calling [price] with `Price.ofNewSubscriptionBulk(newSubscriptionBulk)`. - */ - fun price(newSubscriptionBulk: Price.NewSubscriptionBulkPrice) = - price(Price.ofNewSubscriptionBulk(newSubscriptionBulk)) + /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount)`. + * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price( - newSubscriptionThresholdTotalAmount: Price.NewSubscriptionThresholdTotalAmountPrice - ) = - price( - Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount) - ) + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = + price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)`. - */ - fun price(newSubscriptionTieredPackage: Price.NewSubscriptionTieredPackagePrice) = - price(Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)) + /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ + fun price(tieredPackage: Price.TieredPackage) = + price(Price.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)`. - */ - fun price( - newSubscriptionTieredWithMinimum: Price.NewSubscriptionTieredWithMinimumPrice - ) = price(Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)) + /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun price(tieredWithMinimum: Price.TieredWithMinimum) = + price(Price.ofTieredWithMinimum(tieredWithMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)`. - */ - fun price(newSubscriptionUnitWithPercent: Price.NewSubscriptionUnitWithPercentPrice) = - price(Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)) + /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun price(unitWithPercent: Price.UnitWithPercent) = + price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionPackageWithAllocation(newSubscriptionPackageWithAllocation)`. + * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price( - newSubscriptionPackageWithAllocation: - Price.NewSubscriptionPackageWithAllocationPrice - ) = - price( - Price.ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - ) + fun price(packageWithAllocation: Price.PackageWithAllocation) = + price(Price.ofPackageWithAllocation(packageWithAllocation)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)`. + * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price( - newSubscriptionTierWithProration: Price.NewSubscriptionTierWithProrationPrice - ) = price(Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)) + fun price(tieredWithProration: Price.TieredWithProration) = + price(Price.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)`. - */ - fun price( - newSubscriptionUnitWithProration: Price.NewSubscriptionUnitWithProrationPrice - ) = price(Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)) + /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun price(unitWithProration: Price.UnitWithProration) = + price(Price.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)`. - */ - fun price( - newSubscriptionGroupedAllocation: Price.NewSubscriptionGroupedAllocationPrice - ) = price(Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)) + /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun price(groupedAllocation: Price.GroupedAllocation) = + price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithProratedMinimum(newSubscriptionGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price( - newSubscriptionGroupedWithProratedMinimum: - Price.NewSubscriptionGroupedWithProratedMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - ) + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = + price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)`. - */ - fun price( - newSubscriptionBulkWithProration: Price.NewSubscriptionBulkWithProrationPrice - ) = price(Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)) + /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun price(bulkWithProration: Price.BulkWithProration) = + price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithUnitPricing(newSubscriptionScalableMatrixWithUnitPricing)`. + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithUnitPricing: - Price.NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - ) + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = + price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithTieredPricing(newSubscriptionScalableMatrixWithTieredPricing)`. + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithTieredPricing: - Price.NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - ) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionCumulativeGroupedBulk(newSubscriptionCumulativeGroupedBulk)`. + * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price( - newSubscriptionCumulativeGroupedBulk: - Price.NewSubscriptionCumulativeGroupedBulkPrice - ) = - price( - Price.ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - ) + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = + price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMaxGroupTieredPackage(newSubscriptionMaxGroupTieredPackage)`. + * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price( - newSubscriptionMaxGroupTieredPackage: - Price.NewSubscriptionMaxGroupTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - ) + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = + price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithMeteredMinimum(newSubscriptionGroupedWithMeteredMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price( - newSubscriptionGroupedWithMeteredMinimum: - Price.NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - ) + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = + price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrixWithDisplayName(newSubscriptionMatrixWithDisplayName)`. + * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price( - newSubscriptionMatrixWithDisplayName: - Price.NewSubscriptionMatrixWithDisplayNamePrice - ) = - price( - Price.ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - ) + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = + price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage)`. + * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price( - newSubscriptionGroupedTieredPackage: Price.NewSubscriptionGroupedTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage) - ) + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = + price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** The id of the price to add to the subscription. */ fun priceId(priceId: String?) = priceId(JsonField.ofNullable(priceId)) @@ -67767,401 +66892,257 @@ private constructor( @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val newSubscriptionUnit: NewSubscriptionUnitPrice? = null, - private val newSubscriptionPackage: NewSubscriptionPackagePrice? = null, - private val newSubscriptionMatrix: NewSubscriptionMatrixPrice? = null, - private val newSubscriptionTiered: NewSubscriptionTieredPrice? = null, - private val newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice? = null, - private val newSubscriptionBps: NewSubscriptionBpsPrice? = null, - private val newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice? = null, - private val newSubscriptionBulk: NewSubscriptionBulkPrice? = null, - private val newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice? = - null, - private val newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice? = null, - private val newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice? = - null, - private val newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice? = null, - private val newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice? = - null, - private val newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice? = - null, - private val newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice? = - null, - private val newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice? = - null, - private val newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice? = - null, - private val newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice? = - null, - private val newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice? = - null, - private val newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice? = - null, - private val newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice? = - null, - private val newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice? = - null, - private val newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice? = - null, - private val newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice? = - null, - private val newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice? = - null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val bulkWithProration: BulkWithProration? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, private val _json: JsonValue? = null, ) { - fun newSubscriptionUnit(): Optional = - Optional.ofNullable(newSubscriptionUnit) + fun unit(): Optional = Optional.ofNullable(unit) - fun newSubscriptionPackage(): Optional = - Optional.ofNullable(newSubscriptionPackage) + fun package_(): Optional = Optional.ofNullable(package_) - fun newSubscriptionMatrix(): Optional = - Optional.ofNullable(newSubscriptionMatrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newSubscriptionTiered(): Optional = - Optional.ofNullable(newSubscriptionTiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newSubscriptionTieredBps(): Optional = - Optional.ofNullable(newSubscriptionTieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newSubscriptionBps(): Optional = - Optional.ofNullable(newSubscriptionBps) + fun bps(): Optional = Optional.ofNullable(bps) - fun newSubscriptionBulkBps(): Optional = - Optional.ofNullable(newSubscriptionBulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newSubscriptionBulk(): Optional = - Optional.ofNullable(newSubscriptionBulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newSubscriptionThresholdTotalAmount(): - Optional = - Optional.ofNullable(newSubscriptionThresholdTotalAmount) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newSubscriptionTieredPackage(): Optional = - Optional.ofNullable(newSubscriptionTieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newSubscriptionTieredWithMinimum(): - Optional = - Optional.ofNullable(newSubscriptionTieredWithMinimum) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newSubscriptionUnitWithPercent(): Optional = - Optional.ofNullable(newSubscriptionUnitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newSubscriptionPackageWithAllocation(): - Optional = - Optional.ofNullable(newSubscriptionPackageWithAllocation) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newSubscriptionTierWithProration(): - Optional = - Optional.ofNullable(newSubscriptionTierWithProration) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newSubscriptionUnitWithProration(): - Optional = - Optional.ofNullable(newSubscriptionUnitWithProration) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newSubscriptionGroupedAllocation(): - Optional = - Optional.ofNullable(newSubscriptionGroupedAllocation) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newSubscriptionGroupedWithProratedMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithProratedMinimum) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newSubscriptionBulkWithProration(): - Optional = - Optional.ofNullable(newSubscriptionBulkWithProration) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newSubscriptionScalableMatrixWithUnitPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithUnitPricing) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newSubscriptionScalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithTieredPricing) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newSubscriptionCumulativeGroupedBulk(): - Optional = - Optional.ofNullable(newSubscriptionCumulativeGroupedBulk) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun newSubscriptionMaxGroupTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionMaxGroupTieredPackage) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newSubscriptionGroupedWithMeteredMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithMeteredMinimum) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newSubscriptionMatrixWithDisplayName(): - Optional = - Optional.ofNullable(newSubscriptionMatrixWithDisplayName) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newSubscriptionGroupedTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionGroupedTieredPackage) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun isNewSubscriptionUnit(): Boolean = newSubscriptionUnit != null + fun isUnit(): Boolean = unit != null - fun isNewSubscriptionPackage(): Boolean = newSubscriptionPackage != null + fun isPackage(): Boolean = package_ != null - fun isNewSubscriptionMatrix(): Boolean = newSubscriptionMatrix != null + fun isMatrix(): Boolean = matrix != null - fun isNewSubscriptionTiered(): Boolean = newSubscriptionTiered != null + fun isTiered(): Boolean = tiered != null - fun isNewSubscriptionTieredBps(): Boolean = newSubscriptionTieredBps != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewSubscriptionBps(): Boolean = newSubscriptionBps != null + fun isBps(): Boolean = bps != null - fun isNewSubscriptionBulkBps(): Boolean = newSubscriptionBulkBps != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewSubscriptionBulk(): Boolean = newSubscriptionBulk != null + fun isBulk(): Boolean = bulk != null - fun isNewSubscriptionThresholdTotalAmount(): Boolean = - newSubscriptionThresholdTotalAmount != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewSubscriptionTieredPackage(): Boolean = newSubscriptionTieredPackage != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewSubscriptionTieredWithMinimum(): Boolean = - newSubscriptionTieredWithMinimum != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewSubscriptionUnitWithPercent(): Boolean = newSubscriptionUnitWithPercent != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewSubscriptionPackageWithAllocation(): Boolean = - newSubscriptionPackageWithAllocation != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewSubscriptionTierWithProration(): Boolean = - newSubscriptionTierWithProration != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewSubscriptionUnitWithProration(): Boolean = - newSubscriptionUnitWithProration != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewSubscriptionGroupedAllocation(): Boolean = - newSubscriptionGroupedAllocation != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewSubscriptionGroupedWithProratedMinimum(): Boolean = - newSubscriptionGroupedWithProratedMinimum != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewSubscriptionBulkWithProration(): Boolean = - newSubscriptionBulkWithProration != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewSubscriptionScalableMatrixWithUnitPricing(): Boolean = - newSubscriptionScalableMatrixWithUnitPricing != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewSubscriptionScalableMatrixWithTieredPricing(): Boolean = - newSubscriptionScalableMatrixWithTieredPricing != null + fun isScalableMatrixWithTieredPricing(): Boolean = + scalableMatrixWithTieredPricing != null - fun isNewSubscriptionCumulativeGroupedBulk(): Boolean = - newSubscriptionCumulativeGroupedBulk != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun isNewSubscriptionMaxGroupTieredPackage(): Boolean = - newSubscriptionMaxGroupTieredPackage != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewSubscriptionGroupedWithMeteredMinimum(): Boolean = - newSubscriptionGroupedWithMeteredMinimum != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewSubscriptionMatrixWithDisplayName(): Boolean = - newSubscriptionMatrixWithDisplayName != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewSubscriptionGroupedTieredPackage(): Boolean = - newSubscriptionGroupedTieredPackage != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun asNewSubscriptionUnit(): NewSubscriptionUnitPrice = - newSubscriptionUnit.getOrThrow("newSubscriptionUnit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewSubscriptionPackage(): NewSubscriptionPackagePrice = - newSubscriptionPackage.getOrThrow("newSubscriptionPackage") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewSubscriptionMatrix(): NewSubscriptionMatrixPrice = - newSubscriptionMatrix.getOrThrow("newSubscriptionMatrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewSubscriptionTiered(): NewSubscriptionTieredPrice = - newSubscriptionTiered.getOrThrow("newSubscriptionTiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewSubscriptionTieredBps(): NewSubscriptionTieredBpsPrice = - newSubscriptionTieredBps.getOrThrow("newSubscriptionTieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewSubscriptionBps(): NewSubscriptionBpsPrice = - newSubscriptionBps.getOrThrow("newSubscriptionBps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewSubscriptionBulkBps(): NewSubscriptionBulkBpsPrice = - newSubscriptionBulkBps.getOrThrow("newSubscriptionBulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewSubscriptionBulk(): NewSubscriptionBulkPrice = - newSubscriptionBulk.getOrThrow("newSubscriptionBulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewSubscriptionThresholdTotalAmount(): NewSubscriptionThresholdTotalAmountPrice = - newSubscriptionThresholdTotalAmount.getOrThrow( - "newSubscriptionThresholdTotalAmount" - ) + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewSubscriptionTieredPackage(): NewSubscriptionTieredPackagePrice = - newSubscriptionTieredPackage.getOrThrow("newSubscriptionTieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewSubscriptionTieredWithMinimum(): NewSubscriptionTieredWithMinimumPrice = - newSubscriptionTieredWithMinimum.getOrThrow("newSubscriptionTieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewSubscriptionUnitWithPercent(): NewSubscriptionUnitWithPercentPrice = - newSubscriptionUnitWithPercent.getOrThrow("newSubscriptionUnitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewSubscriptionPackageWithAllocation(): - NewSubscriptionPackageWithAllocationPrice = - newSubscriptionPackageWithAllocation.getOrThrow( - "newSubscriptionPackageWithAllocation" - ) + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewSubscriptionTierWithProration(): NewSubscriptionTierWithProrationPrice = - newSubscriptionTierWithProration.getOrThrow("newSubscriptionTierWithProration") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewSubscriptionUnitWithProration(): NewSubscriptionUnitWithProrationPrice = - newSubscriptionUnitWithProration.getOrThrow("newSubscriptionUnitWithProration") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewSubscriptionGroupedAllocation(): NewSubscriptionGroupedAllocationPrice = - newSubscriptionGroupedAllocation.getOrThrow("newSubscriptionGroupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewSubscriptionGroupedWithProratedMinimum(): - NewSubscriptionGroupedWithProratedMinimumPrice = - newSubscriptionGroupedWithProratedMinimum.getOrThrow( - "newSubscriptionGroupedWithProratedMinimum" - ) + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewSubscriptionBulkWithProration(): NewSubscriptionBulkWithProrationPrice = - newSubscriptionBulkWithProration.getOrThrow("newSubscriptionBulkWithProration") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewSubscriptionScalableMatrixWithUnitPricing(): - NewSubscriptionScalableMatrixWithUnitPricingPrice = - newSubscriptionScalableMatrixWithUnitPricing.getOrThrow( - "newSubscriptionScalableMatrixWithUnitPricing" - ) + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewSubscriptionScalableMatrixWithTieredPricing(): - NewSubscriptionScalableMatrixWithTieredPricingPrice = - newSubscriptionScalableMatrixWithTieredPricing.getOrThrow( - "newSubscriptionScalableMatrixWithTieredPricing" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewSubscriptionCumulativeGroupedBulk(): - NewSubscriptionCumulativeGroupedBulkPrice = - newSubscriptionCumulativeGroupedBulk.getOrThrow( - "newSubscriptionCumulativeGroupedBulk" - ) + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") - fun asNewSubscriptionMaxGroupTieredPackage(): - NewSubscriptionMaxGroupTieredPackagePrice = - newSubscriptionMaxGroupTieredPackage.getOrThrow( - "newSubscriptionMaxGroupTieredPackage" - ) + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewSubscriptionGroupedWithMeteredMinimum(): - NewSubscriptionGroupedWithMeteredMinimumPrice = - newSubscriptionGroupedWithMeteredMinimum.getOrThrow( - "newSubscriptionGroupedWithMeteredMinimum" - ) + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewSubscriptionMatrixWithDisplayName(): - NewSubscriptionMatrixWithDisplayNamePrice = - newSubscriptionMatrixWithDisplayName.getOrThrow( - "newSubscriptionMatrixWithDisplayName" - ) + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewSubscriptionGroupedTieredPackage(): NewSubscriptionGroupedTieredPackagePrice = - newSubscriptionGroupedTieredPackage.getOrThrow( - "newSubscriptionGroupedTieredPackage" - ) + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newSubscriptionUnit != null -> - visitor.visitNewSubscriptionUnit(newSubscriptionUnit) - newSubscriptionPackage != null -> - visitor.visitNewSubscriptionPackage(newSubscriptionPackage) - newSubscriptionMatrix != null -> - visitor.visitNewSubscriptionMatrix(newSubscriptionMatrix) - newSubscriptionTiered != null -> - visitor.visitNewSubscriptionTiered(newSubscriptionTiered) - newSubscriptionTieredBps != null -> - visitor.visitNewSubscriptionTieredBps(newSubscriptionTieredBps) - newSubscriptionBps != null -> - visitor.visitNewSubscriptionBps(newSubscriptionBps) - newSubscriptionBulkBps != null -> - visitor.visitNewSubscriptionBulkBps(newSubscriptionBulkBps) - newSubscriptionBulk != null -> - visitor.visitNewSubscriptionBulk(newSubscriptionBulk) - newSubscriptionThresholdTotalAmount != null -> - visitor.visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount - ) - newSubscriptionTieredPackage != null -> - visitor.visitNewSubscriptionTieredPackage(newSubscriptionTieredPackage) - newSubscriptionTieredWithMinimum != null -> - visitor.visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum - ) - newSubscriptionUnitWithPercent != null -> - visitor.visitNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent) - newSubscriptionPackageWithAllocation != null -> - visitor.visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - newSubscriptionTierWithProration != null -> - visitor.visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration - ) - newSubscriptionUnitWithProration != null -> - visitor.visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration - ) - newSubscriptionGroupedAllocation != null -> - visitor.visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation - ) - newSubscriptionGroupedWithProratedMinimum != null -> - visitor.visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - newSubscriptionBulkWithProration != null -> - visitor.visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration - ) - newSubscriptionScalableMatrixWithUnitPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - newSubscriptionScalableMatrixWithTieredPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - newSubscriptionCumulativeGroupedBulk != null -> - visitor.visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - newSubscriptionMaxGroupTieredPackage != null -> - visitor.visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - newSubscriptionGroupedWithMeteredMinimum != null -> - visitor.visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - newSubscriptionMatrixWithDisplayName != null -> - visitor.visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - newSubscriptionGroupedTieredPackage != null -> - visitor.visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredWithProration != null -> + visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing ) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) else -> visitor.unknown(_json) } @@ -68174,164 +67155,126 @@ private constructor( accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) { - newSubscriptionUnit.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) { - newSubscriptionPackage.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) { - newSubscriptionMatrix.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) { - newSubscriptionTiered.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) { - newSubscriptionTieredBps.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) { - newSubscriptionBps.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) { - newSubscriptionBulkBps.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) { - newSubscriptionBulk.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newSubscriptionThresholdTotalAmount.validate() + thresholdTotalAmount.validate() } - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) { - newSubscriptionTieredPackage.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) { - newSubscriptionTieredWithMinimum.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) { - newSubscriptionUnitWithPercent.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newSubscriptionPackageWithAllocation.validate() + packageWithAllocation.validate() } - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newSubscriptionTierWithProration.validate() + tieredWithProration.validate() } - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) { - newSubscriptionUnitWithProration.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) { - newSubscriptionGroupedAllocation.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newSubscriptionGroupedWithProratedMinimum.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) { - newSubscriptionBulkWithProration.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newSubscriptionScalableMatrixWithUnitPricing.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newSubscriptionScalableMatrixWithTieredPricing.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newSubscriptionCumulativeGroupedBulk.validate() + cumulativeGroupedBulk.validate() } - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newSubscriptionMaxGroupTieredPackage.validate() + maxGroupTieredPackage.validate() } - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newSubscriptionGroupedWithMeteredMinimum.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newSubscriptionMatrixWithDisplayName.validate() + matrixWithDisplayName.validate() } - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newSubscriptionGroupedTieredPackage.validate() + groupedTieredPackage.validate() } } ) @@ -68356,115 +67299,83 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) = newSubscriptionUnit.validity() - - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) = newSubscriptionPackage.validity() - - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) = newSubscriptionMatrix.validity() - - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) = newSubscriptionTiered.validity() - - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = newSubscriptionTieredBps.validity() - - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) = newSubscriptionBps.validity() - - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) = newSubscriptionBulkBps.validity() - - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) = newSubscriptionBulk.validity() - - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice - ) = newSubscriptionThresholdTotalAmount.validity() - - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = newSubscriptionTieredPackage.validity() - - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = newSubscriptionTieredWithMinimum.validity() - - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = newSubscriptionUnitWithPercent.validity() - - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice - ) = newSubscriptionPackageWithAllocation.validity() - - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = newSubscriptionTierWithProration.validity() - - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = newSubscriptionUnitWithProration.validity() - - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = newSubscriptionGroupedAllocation.validity() - - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = newSubscriptionGroupedWithProratedMinimum.validity() - - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = newSubscriptionBulkWithProration.validity() - - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = newSubscriptionScalableMatrixWithUnitPricing.validity() - - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = newSubscriptionScalableMatrixWithTieredPricing.validity() - - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice - ) = newSubscriptionCumulativeGroupedBulk.validity() - - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice - ) = newSubscriptionMaxGroupTieredPackage.validity() - - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = newSubscriptionGroupedWithMeteredMinimum.validity() - - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice - ) = newSubscriptionMatrixWithDisplayName.validity() - - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice - ) = newSubscriptionGroupedTieredPackage.validity() + override fun visitUnit(unit: Unit) = unit.validity() + + override fun visitPackage(package_: Package) = package_.validity() + + override fun visitMatrix(matrix: Matrix) = matrix.validity() + + override fun visitTiered(tiered: Tiered) = tiered.validity() + + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() + + override fun visitBps(bps: Bps) = bps.validity() + + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() + + override fun visitBulk(bulk: Bulk) = bulk.validity() + + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() + + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() + + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() + + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() + + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() + + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() + + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() + + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() + + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() + + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() + + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() + + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() + + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() + + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() + + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() + + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() + + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -68475,215 +67386,141 @@ private constructor( return true } - return /* spotless:off */ other is Price && newSubscriptionUnit == other.newSubscriptionUnit && newSubscriptionPackage == other.newSubscriptionPackage && newSubscriptionMatrix == other.newSubscriptionMatrix && newSubscriptionTiered == other.newSubscriptionTiered && newSubscriptionTieredBps == other.newSubscriptionTieredBps && newSubscriptionBps == other.newSubscriptionBps && newSubscriptionBulkBps == other.newSubscriptionBulkBps && newSubscriptionBulk == other.newSubscriptionBulk && newSubscriptionThresholdTotalAmount == other.newSubscriptionThresholdTotalAmount && newSubscriptionTieredPackage == other.newSubscriptionTieredPackage && newSubscriptionTieredWithMinimum == other.newSubscriptionTieredWithMinimum && newSubscriptionUnitWithPercent == other.newSubscriptionUnitWithPercent && newSubscriptionPackageWithAllocation == other.newSubscriptionPackageWithAllocation && newSubscriptionTierWithProration == other.newSubscriptionTierWithProration && newSubscriptionUnitWithProration == other.newSubscriptionUnitWithProration && newSubscriptionGroupedAllocation == other.newSubscriptionGroupedAllocation && newSubscriptionGroupedWithProratedMinimum == other.newSubscriptionGroupedWithProratedMinimum && newSubscriptionBulkWithProration == other.newSubscriptionBulkWithProration && newSubscriptionScalableMatrixWithUnitPricing == other.newSubscriptionScalableMatrixWithUnitPricing && newSubscriptionScalableMatrixWithTieredPricing == other.newSubscriptionScalableMatrixWithTieredPricing && newSubscriptionCumulativeGroupedBulk == other.newSubscriptionCumulativeGroupedBulk && newSubscriptionMaxGroupTieredPackage == other.newSubscriptionMaxGroupTieredPackage && newSubscriptionGroupedWithMeteredMinimum == other.newSubscriptionGroupedWithMeteredMinimum && newSubscriptionMatrixWithDisplayName == other.newSubscriptionMatrixWithDisplayName && newSubscriptionGroupedTieredPackage == other.newSubscriptionGroupedTieredPackage /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && bulkWithProration == other.bulkWithProration && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk && maxGroupTieredPackage == other.maxGroupTieredPackage && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && groupedTieredPackage == other.groupedTieredPackage /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newSubscriptionUnit, newSubscriptionPackage, newSubscriptionMatrix, newSubscriptionTiered, newSubscriptionTieredBps, newSubscriptionBps, newSubscriptionBulkBps, newSubscriptionBulk, newSubscriptionThresholdTotalAmount, newSubscriptionTieredPackage, newSubscriptionTieredWithMinimum, newSubscriptionUnitWithPercent, newSubscriptionPackageWithAllocation, newSubscriptionTierWithProration, newSubscriptionUnitWithProration, newSubscriptionGroupedAllocation, newSubscriptionGroupedWithProratedMinimum, newSubscriptionBulkWithProration, newSubscriptionScalableMatrixWithUnitPricing, newSubscriptionScalableMatrixWithTieredPricing, newSubscriptionCumulativeGroupedBulk, newSubscriptionMaxGroupTieredPackage, newSubscriptionGroupedWithMeteredMinimum, newSubscriptionMatrixWithDisplayName, newSubscriptionGroupedTieredPackage) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, bulkWithProration, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk, maxGroupTieredPackage, groupedWithMeteredMinimum, matrixWithDisplayName, groupedTieredPackage) /* spotless:on */ override fun toString(): String = when { - newSubscriptionUnit != null -> "Price{newSubscriptionUnit=$newSubscriptionUnit}" - newSubscriptionPackage != null -> - "Price{newSubscriptionPackage=$newSubscriptionPackage}" - newSubscriptionMatrix != null -> - "Price{newSubscriptionMatrix=$newSubscriptionMatrix}" - newSubscriptionTiered != null -> - "Price{newSubscriptionTiered=$newSubscriptionTiered}" - newSubscriptionTieredBps != null -> - "Price{newSubscriptionTieredBps=$newSubscriptionTieredBps}" - newSubscriptionBps != null -> "Price{newSubscriptionBps=$newSubscriptionBps}" - newSubscriptionBulkBps != null -> - "Price{newSubscriptionBulkBps=$newSubscriptionBulkBps}" - newSubscriptionBulk != null -> "Price{newSubscriptionBulk=$newSubscriptionBulk}" - newSubscriptionThresholdTotalAmount != null -> - "Price{newSubscriptionThresholdTotalAmount=$newSubscriptionThresholdTotalAmount}" - newSubscriptionTieredPackage != null -> - "Price{newSubscriptionTieredPackage=$newSubscriptionTieredPackage}" - newSubscriptionTieredWithMinimum != null -> - "Price{newSubscriptionTieredWithMinimum=$newSubscriptionTieredWithMinimum}" - newSubscriptionUnitWithPercent != null -> - "Price{newSubscriptionUnitWithPercent=$newSubscriptionUnitWithPercent}" - newSubscriptionPackageWithAllocation != null -> - "Price{newSubscriptionPackageWithAllocation=$newSubscriptionPackageWithAllocation}" - newSubscriptionTierWithProration != null -> - "Price{newSubscriptionTierWithProration=$newSubscriptionTierWithProration}" - newSubscriptionUnitWithProration != null -> - "Price{newSubscriptionUnitWithProration=$newSubscriptionUnitWithProration}" - newSubscriptionGroupedAllocation != null -> - "Price{newSubscriptionGroupedAllocation=$newSubscriptionGroupedAllocation}" - newSubscriptionGroupedWithProratedMinimum != null -> - "Price{newSubscriptionGroupedWithProratedMinimum=$newSubscriptionGroupedWithProratedMinimum}" - newSubscriptionBulkWithProration != null -> - "Price{newSubscriptionBulkWithProration=$newSubscriptionBulkWithProration}" - newSubscriptionScalableMatrixWithUnitPricing != null -> - "Price{newSubscriptionScalableMatrixWithUnitPricing=$newSubscriptionScalableMatrixWithUnitPricing}" - newSubscriptionScalableMatrixWithTieredPricing != null -> - "Price{newSubscriptionScalableMatrixWithTieredPricing=$newSubscriptionScalableMatrixWithTieredPricing}" - newSubscriptionCumulativeGroupedBulk != null -> - "Price{newSubscriptionCumulativeGroupedBulk=$newSubscriptionCumulativeGroupedBulk}" - newSubscriptionMaxGroupTieredPackage != null -> - "Price{newSubscriptionMaxGroupTieredPackage=$newSubscriptionMaxGroupTieredPackage}" - newSubscriptionGroupedWithMeteredMinimum != null -> - "Price{newSubscriptionGroupedWithMeteredMinimum=$newSubscriptionGroupedWithMeteredMinimum}" - newSubscriptionMatrixWithDisplayName != null -> - "Price{newSubscriptionMatrixWithDisplayName=$newSubscriptionMatrixWithDisplayName}" - newSubscriptionGroupedTieredPackage != null -> - "Price{newSubscriptionGroupedTieredPackage=$newSubscriptionGroupedTieredPackage}" + unit != null -> "Price{unit=$unit}" + package_ != null -> "Price{package_=$package_}" + matrix != null -> "Price{matrix=$matrix}" + tiered != null -> "Price{tiered=$tiered}" + tieredBps != null -> "Price{tieredBps=$tieredBps}" + bps != null -> "Price{bps=$bps}" + bulkBps != null -> "Price{bulkBps=$bulkBps}" + bulk != null -> "Price{bulk=$bulk}" + thresholdTotalAmount != null -> + "Price{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" + tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" + unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" + packageWithAllocation != null -> + "Price{packageWithAllocation=$packageWithAllocation}" + tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" + scalableMatrixWithUnitPricing != null -> + "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" + maxGroupTieredPackage != null -> + "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" + groupedWithMeteredMinimum != null -> + "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Price{matrixWithDisplayName=$matrixWithDisplayName}" + groupedTieredPackage != null -> + "Price{groupedTieredPackage=$groupedTieredPackage}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } companion object { - @JvmStatic - fun ofNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice) = - Price(newSubscriptionUnit = newSubscriptionUnit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofNewSubscriptionPackage(newSubscriptionPackage: NewSubscriptionPackagePrice) = - Price(newSubscriptionPackage = newSubscriptionPackage) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic - fun ofNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice) = - Price(newSubscriptionMatrix = newSubscriptionMatrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) - @JvmStatic - fun ofNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice) = - Price(newSubscriptionTiered = newSubscriptionTiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic - fun ofNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = Price(newSubscriptionTieredBps = newSubscriptionTieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic - fun ofNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice) = - Price(newSubscriptionBps = newSubscriptionBps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic - fun ofNewSubscriptionBulkBps(newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice) = - Price(newSubscriptionBulkBps = newSubscriptionBulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic - fun ofNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice) = - Price(newSubscriptionBulk = newSubscriptionBulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ) = Price(newSubscriptionThresholdTotalAmount = newSubscriptionThresholdTotalAmount) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = Price(newSubscriptionTieredPackage = newSubscriptionTieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = + Price(tieredPackage = tieredPackage) @JvmStatic - fun ofNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = Price(newSubscriptionTieredWithMinimum = newSubscriptionTieredWithMinimum) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = Price(newSubscriptionUnitWithPercent = newSubscriptionUnitWithPercent) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ) = - Price( - newSubscriptionPackageWithAllocation = newSubscriptionPackageWithAllocation - ) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = Price(newSubscriptionTierWithProration = newSubscriptionTierWithProration) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = Price(newSubscriptionUnitWithProration = newSubscriptionUnitWithProration) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Price(unitWithProration = unitWithProration) @JvmStatic - fun ofNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = Price(newSubscriptionGroupedAllocation = newSubscriptionGroupedAllocation) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = - Price( - newSubscriptionGroupedWithProratedMinimum = - newSubscriptionGroupedWithProratedMinimum - ) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = Price(newSubscriptionBulkWithProration = newSubscriptionBulkWithProration) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithUnitPricing = - newSubscriptionScalableMatrixWithUnitPricing - ) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithTieredPricing = - newSubscriptionScalableMatrixWithTieredPricing - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ) = - Price( - newSubscriptionCumulativeGroupedBulk = newSubscriptionCumulativeGroupedBulk - ) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Price(cumulativeGroupedBulk = cumulativeGroupedBulk) @JvmStatic - fun ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ) = - Price( - newSubscriptionMaxGroupTieredPackage = newSubscriptionMaxGroupTieredPackage - ) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - Price( - newSubscriptionGroupedWithMeteredMinimum = - newSubscriptionGroupedWithMeteredMinimum - ) + fun ofGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ) = - Price( - newSubscriptionMatrixWithDisplayName = newSubscriptionMatrixWithDisplayName - ) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ) = Price(newSubscriptionGroupedTieredPackage = newSubscriptionGroupedTieredPackage) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Price(groupedTieredPackage = groupedTieredPackage) } /** @@ -68691,99 +67528,63 @@ private constructor( */ interface Visitor { - fun visitNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ): T + fun visitPackage(package_: Package): T - fun visitNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T - fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -68809,221 +67610,138 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionUnit = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unit = it, _json = json) + } ?: Price(_json = json) } "package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) + } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionMatrix = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrix = it, _json = json) + } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTiered = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tiered = it, _json = json) + } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredBps = it, _json = json) + } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bps = it, _json = json) + } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkBps = it, _json = json) + } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBulk = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulk = it, _json = json) + } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionThresholdTotalAmount = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(thresholdTotalAmount = it, _json = json) } + ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackage = it, _json = json) + } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithMinimum = it, _json = json) + } ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithPercent = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithPercent = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionPackageWithAllocation = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(packageWithAllocation = it, _json = json) } + ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTierWithProration = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(tieredWithProration = it, _json = json) } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionGroupedAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedAllocation = it, _json = json) + } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionGroupedWithProratedMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(groupedWithProratedMinimum = it, _json = json) } + ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkWithProration = it, _json = json) + } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithUnitPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithUnitPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } + ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithTieredPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithTieredPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionCumulativeGroupedBulk = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(cumulativeGroupedBulk = it, _json = json) } + ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMaxGroupTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(maxGroupTieredPackage = it, _json = json) } + ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price( - newSubscriptionGroupedWithMeteredMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } + ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMatrixWithDisplayName = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(matrixWithDisplayName = it, _json = json) } + ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionGroupedTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedTieredPackage = it, _json = json) } + ?: Price(_json = json) } } @@ -69039,67 +67757,54 @@ private constructor( provider: SerializerProvider, ) { when { - value.newSubscriptionUnit != null -> - generator.writeObject(value.newSubscriptionUnit) - value.newSubscriptionPackage != null -> - generator.writeObject(value.newSubscriptionPackage) - value.newSubscriptionMatrix != null -> - generator.writeObject(value.newSubscriptionMatrix) - value.newSubscriptionTiered != null -> - generator.writeObject(value.newSubscriptionTiered) - value.newSubscriptionTieredBps != null -> - generator.writeObject(value.newSubscriptionTieredBps) - value.newSubscriptionBps != null -> - generator.writeObject(value.newSubscriptionBps) - value.newSubscriptionBulkBps != null -> - generator.writeObject(value.newSubscriptionBulkBps) - value.newSubscriptionBulk != null -> - generator.writeObject(value.newSubscriptionBulk) - value.newSubscriptionThresholdTotalAmount != null -> - generator.writeObject(value.newSubscriptionThresholdTotalAmount) - value.newSubscriptionTieredPackage != null -> - generator.writeObject(value.newSubscriptionTieredPackage) - value.newSubscriptionTieredWithMinimum != null -> - generator.writeObject(value.newSubscriptionTieredWithMinimum) - value.newSubscriptionUnitWithPercent != null -> - generator.writeObject(value.newSubscriptionUnitWithPercent) - value.newSubscriptionPackageWithAllocation != null -> - generator.writeObject(value.newSubscriptionPackageWithAllocation) - value.newSubscriptionTierWithProration != null -> - generator.writeObject(value.newSubscriptionTierWithProration) - value.newSubscriptionUnitWithProration != null -> - generator.writeObject(value.newSubscriptionUnitWithProration) - value.newSubscriptionGroupedAllocation != null -> - generator.writeObject(value.newSubscriptionGroupedAllocation) - value.newSubscriptionGroupedWithProratedMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithProratedMinimum) - value.newSubscriptionBulkWithProration != null -> - generator.writeObject(value.newSubscriptionBulkWithProration) - value.newSubscriptionScalableMatrixWithUnitPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithUnitPricing - ) - value.newSubscriptionScalableMatrixWithTieredPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithTieredPricing - ) - value.newSubscriptionCumulativeGroupedBulk != null -> - generator.writeObject(value.newSubscriptionCumulativeGroupedBulk) - value.newSubscriptionMaxGroupTieredPackage != null -> - generator.writeObject(value.newSubscriptionMaxGroupTieredPackage) - value.newSubscriptionGroupedWithMeteredMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithMeteredMinimum) - value.newSubscriptionMatrixWithDisplayName != null -> - generator.writeObject(value.newSubscriptionMatrixWithDisplayName) - value.newSubscriptionGroupedTieredPackage != null -> - generator.writeObject(value.newSubscriptionGroupedTieredPackage) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.unitWithPercent != null -> + generator.writeObject(value.unitWithPercent) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } } } - class NewSubscriptionUnitPrice + class Unit private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -69505,8 +68210,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -69519,7 +68223,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -69544,27 +68248,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - cadence = newSubscriptionUnitPrice.cadence - itemId = newSubscriptionUnitPrice.itemId - modelType = newSubscriptionUnitPrice.modelType - name = newSubscriptionUnitPrice.name - unitConfig = newSubscriptionUnitPrice.unitConfig - billableMetricId = newSubscriptionUnitPrice.billableMetricId - billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitPrice.conversionRate - 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() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + currency = unit.currency + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + referenceId = unit.referenceId + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -69937,7 +68638,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -69951,8 +68652,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitPrice = - NewSubscriptionUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -69975,7 +68676,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -71204,7 +69905,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -71214,10 +69915,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewSubscriptionPackagePrice + class Package private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -71623,8 +70324,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -71637,7 +70337,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -71662,29 +70362,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = - apply { - cadence = newSubscriptionPackagePrice.cadence - itemId = newSubscriptionPackagePrice.itemId - modelType = newSubscriptionPackagePrice.modelType - name = newSubscriptionPackagePrice.name - packageConfig = newSubscriptionPackagePrice.packageConfig - billableMetricId = newSubscriptionPackagePrice.billableMetricId - billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionPackagePrice.conversionRate - 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() - } + internal fun from(package_: Package) = apply { + cadence = package_.cadence + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + currency = package_.currency + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + referenceId = package_.referenceId + additionalProperties = package_.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -72057,7 +70753,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -72071,8 +70767,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackagePrice = - NewSubscriptionPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -72095,7 +70791,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -73375,7 +72071,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -73385,10 +72081,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewSubscriptionMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -73794,8 +72490,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -73808,7 +72503,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -73833,29 +72528,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = - apply { - cadence = newSubscriptionMatrixPrice.cadence - itemId = newSubscriptionMatrixPrice.itemId - matrixConfig = newSubscriptionMatrixPrice.matrixConfig - modelType = newSubscriptionMatrixPrice.modelType - name = newSubscriptionMatrixPrice.name - billableMetricId = newSubscriptionMatrixPrice.billableMetricId - billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixPrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixPrice.conversionRate - 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() - } + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + currency = matrix.currency + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + referenceId = matrix.referenceId + additionalProperties = matrix.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -74228,7 +72919,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -74242,8 +72933,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixPrice = - NewSubscriptionMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), @@ -74266,7 +72957,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -75869,7 +74560,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -75879,10 +74570,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewSubscriptionTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -76288,8 +74979,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -76302,7 +74992,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -76327,29 +75017,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = - apply { - cadence = newSubscriptionTieredPrice.cadence - itemId = newSubscriptionTieredPrice.itemId - modelType = newSubscriptionTieredPrice.modelType - name = newSubscriptionTieredPrice.name - tieredConfig = newSubscriptionTieredPrice.tieredConfig - billableMetricId = newSubscriptionTieredPrice.billableMetricId - billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPrice.conversionRate - 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() - } + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + currency = tiered.currency + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + referenceId = tiered.referenceId + additionalProperties = tiered.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -76722,7 +75408,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -76736,8 +75422,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPrice = - NewSubscriptionTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -76760,7 +75446,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -78281,7 +76967,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -78291,10 +76977,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewSubscriptionTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -78701,8 +77387,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -78715,7 +77400,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -78740,29 +77425,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice - ) = apply { - cadence = newSubscriptionTieredBpsPrice.cadence - itemId = newSubscriptionTieredBpsPrice.itemId - modelType = newSubscriptionTieredBpsPrice.modelType - name = newSubscriptionTieredBpsPrice.name - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig - billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredBpsPrice.conversionRate - 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() + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + currency = tieredBps.currency + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + referenceId = tieredBps.referenceId + additionalProperties = tieredBps.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -79136,7 +77816,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -79150,8 +77830,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredBpsPrice = - NewSubscriptionTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -79174,7 +77854,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -80737,7 +79417,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -80747,10 +79427,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewSubscriptionBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -81156,8 +79836,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -81170,7 +79849,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -81195,27 +79874,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - bpsConfig = newSubscriptionBpsPrice.bpsConfig - cadence = newSubscriptionBpsPrice.cadence - itemId = newSubscriptionBpsPrice.itemId - modelType = newSubscriptionBpsPrice.modelType - name = newSubscriptionBpsPrice.name - billableMetricId = newSubscriptionBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBpsPrice.conversionRate - 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() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + currency = bps.currency + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + referenceId = bps.referenceId + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -81588,7 +80264,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -81602,8 +80278,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBpsPrice = - NewSubscriptionBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -81626,7 +80302,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -82902,7 +81578,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -82912,10 +81588,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewSubscriptionBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -83321,8 +81997,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -83335,7 +82010,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -83360,29 +82035,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = - apply { - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig - cadence = newSubscriptionBulkBpsPrice.cadence - itemId = newSubscriptionBulkBpsPrice.itemId - modelType = newSubscriptionBulkBpsPrice.modelType - name = newSubscriptionBulkBpsPrice.name - billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkBpsPrice.conversionRate - 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() - } + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + currency = bulkBps.currency + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + referenceId = bulkBps.referenceId + additionalProperties = bulkBps.additionalProperties.toMutableMap() + } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = bulkBpsConfig(JsonField.of(bulkBpsConfig)) @@ -83755,7 +82426,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -83769,8 +82440,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkBpsPrice = - NewSubscriptionBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -83793,7 +82464,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -85310,7 +83981,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -85320,10 +83991,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewSubscriptionBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -85729,8 +84400,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -85743,7 +84413,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -85768,27 +84438,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - bulkConfig = newSubscriptionBulkPrice.bulkConfig - cadence = newSubscriptionBulkPrice.cadence - itemId = newSubscriptionBulkPrice.itemId - modelType = newSubscriptionBulkPrice.modelType - name = newSubscriptionBulkPrice.name - billableMetricId = newSubscriptionBulkPrice.billableMetricId - billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkPrice.conversionRate - 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() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + currency = bulk.currency + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + referenceId = bulk.referenceId + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -86161,7 +84828,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -86175,8 +84842,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkPrice = - NewSubscriptionBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -86199,7 +84866,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -87674,7 +86341,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -87684,10 +86351,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewSubscriptionThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -88097,7 +86764,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionThresholdTotalAmountPrice]. + * [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -88110,7 +86777,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -88136,34 +86803,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionThresholdTotalAmountPrice: - NewSubscriptionThresholdTotalAmountPrice - ) = apply { - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - itemId = newSubscriptionThresholdTotalAmountPrice.itemId - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - name = newSubscriptionThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - currency = newSubscriptionThresholdTotalAmountPrice.currency - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + currency = thresholdTotalAmount.currency + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId + thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata + referenceId = thresholdTotalAmount.referenceId additionalProperties = - newSubscriptionThresholdTotalAmountPrice.additionalProperties - .toMutableMap() + thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -88539,7 +87198,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -88553,8 +87212,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionThresholdTotalAmountPrice = - NewSubscriptionThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -88577,7 +87236,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -89751,7 +88410,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -89761,10 +88420,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewSubscriptionTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -90171,8 +88830,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -90185,7 +88843,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -90210,29 +88868,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice - ) = apply { - cadence = newSubscriptionTieredPackagePrice.cadence - itemId = newSubscriptionTieredPackagePrice.itemId - modelType = newSubscriptionTieredPackagePrice.modelType - name = newSubscriptionTieredPackagePrice.name - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig - billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPackagePrice.conversionRate - 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() + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + currency = tieredPackage.currency + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + referenceId = tieredPackage.referenceId + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -90607,7 +89260,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -90621,8 +89274,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPackagePrice = - NewSubscriptionTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -90645,7 +89298,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -91816,7 +90469,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -91826,10 +90479,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewSubscriptionTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -92238,7 +90891,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredWithMinimumPrice]. + * [TieredWithMinimum]. * * The following fields are required: * ```java @@ -92251,7 +90904,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -92276,33 +90929,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice - ) = apply { - cadence = newSubscriptionTieredWithMinimumPrice.cadence - itemId = newSubscriptionTieredWithMinimumPrice.itemId - modelType = newSubscriptionTieredWithMinimumPrice.modelType - name = newSubscriptionTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - currency = newSubscriptionTieredWithMinimumPrice.currency - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newSubscriptionTieredWithMinimumPrice.metadata - referenceId = newSubscriptionTieredWithMinimumPrice.referenceId - additionalProperties = - newSubscriptionTieredWithMinimumPrice.additionalProperties - .toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + currency = tieredWithMinimum.currency + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + referenceId = tieredWithMinimum.referenceId + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -92676,7 +91320,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -92690,8 +91334,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredWithMinimumPrice = - NewSubscriptionTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -92714,7 +91358,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -93888,7 +92532,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -93898,10 +92542,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewSubscriptionUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -94309,8 +92953,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -94323,7 +92966,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -94348,30 +92991,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice - ) = apply { - cadence = newSubscriptionUnitWithPercentPrice.cadence - itemId = newSubscriptionUnitWithPercentPrice.itemId - modelType = newSubscriptionUnitWithPercentPrice.modelType - name = newSubscriptionUnitWithPercentPrice.name - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig - billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - 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() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + currency = unitWithPercent.currency + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + referenceId = unitWithPercent.referenceId + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -94745,7 +93382,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -94759,8 +93396,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithPercentPrice = - NewSubscriptionUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -94783,7 +93420,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -95954,7 +94591,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -95964,10 +94601,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewSubscriptionPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -96377,7 +95014,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -96390,7 +95027,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -96417,35 +95054,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionPackageWithAllocationPrice: - NewSubscriptionPackageWithAllocationPrice - ) = apply { - cadence = newSubscriptionPackageWithAllocationPrice.cadence - itemId = newSubscriptionPackageWithAllocationPrice.itemId - modelType = newSubscriptionPackageWithAllocationPrice.modelType - name = newSubscriptionPackageWithAllocationPrice.name + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = - newSubscriptionPackageWithAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - currency = newSubscriptionPackageWithAllocationPrice.currency - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey + packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + currency = packageWithAllocation.currency + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionPackageWithAllocationPrice.metadata - referenceId = newSubscriptionPackageWithAllocationPrice.referenceId + packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata + referenceId = packageWithAllocation.referenceId additionalProperties = - newSubscriptionPackageWithAllocationPrice.additionalProperties - .toMutableMap() + packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -96821,7 +95450,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -96835,8 +95464,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackageWithAllocationPrice = - NewSubscriptionPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -96862,7 +95491,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -98037,7 +96666,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -98047,10 +96676,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewSubscriptionTierWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -98460,7 +97089,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTierWithProrationPrice]. + * [TieredWithProration]. * * The following fields are required: * ```java @@ -98473,7 +97102,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTierWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -98499,33 +97128,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice - ) = apply { - cadence = newSubscriptionTierWithProrationPrice.cadence - itemId = newSubscriptionTierWithProrationPrice.itemId - modelType = newSubscriptionTierWithProrationPrice.modelType - name = newSubscriptionTierWithProrationPrice.name - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - currency = newSubscriptionTierWithProrationPrice.currency - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTierWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTierWithProrationPrice.invoiceGroupingKey + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + currency = tieredWithProration.currency + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionTierWithProrationPrice.metadata - referenceId = newSubscriptionTierWithProrationPrice.referenceId + tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata + referenceId = tieredWithProration.referenceId additionalProperties = - newSubscriptionTierWithProrationPrice.additionalProperties - .toMutableMap() + tieredWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -98900,7 +97522,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTierWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -98914,8 +97536,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTierWithProrationPrice = - NewSubscriptionTierWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -98938,7 +97560,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTierWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -100112,7 +98734,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -100122,10 +98744,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewSubscriptionUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -100534,7 +99156,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithProrationPrice]. + * [UnitWithProration]. * * The following fields are required: * ```java @@ -100547,7 +99169,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -100572,33 +99194,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice - ) = apply { - cadence = newSubscriptionUnitWithProrationPrice.cadence - itemId = newSubscriptionUnitWithProrationPrice.itemId - modelType = newSubscriptionUnitWithProrationPrice.modelType - name = newSubscriptionUnitWithProrationPrice.name - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - currency = newSubscriptionUnitWithProrationPrice.currency - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionUnitWithProrationPrice.metadata - referenceId = newSubscriptionUnitWithProrationPrice.referenceId - additionalProperties = - newSubscriptionUnitWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + currency = unitWithProration.currency + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + referenceId = unitWithProration.referenceId + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -100972,7 +99585,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -100986,8 +99599,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithProrationPrice = - NewSubscriptionUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -101010,7 +99623,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -102184,7 +100797,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -102194,10 +100807,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewSubscriptionGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, @@ -102606,7 +101219,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedAllocationPrice]. + * [GroupedAllocation]. * * The following fields are required: * ```java @@ -102619,7 +101232,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -102644,33 +101257,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice - ) = apply { - cadence = newSubscriptionGroupedAllocationPrice.cadence - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - itemId = newSubscriptionGroupedAllocationPrice.itemId - modelType = newSubscriptionGroupedAllocationPrice.modelType - name = newSubscriptionGroupedAllocationPrice.name - billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - currency = newSubscriptionGroupedAllocationPrice.currency - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedAllocationPrice.metadata - referenceId = newSubscriptionGroupedAllocationPrice.referenceId - additionalProperties = - newSubscriptionGroupedAllocationPrice.additionalProperties - .toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + currency = groupedAllocation.currency + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + referenceId = groupedAllocation.referenceId + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -103044,7 +101648,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -103058,8 +101662,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedAllocationPrice = - NewSubscriptionGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), @@ -103082,7 +101686,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -104254,7 +102858,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -104264,10 +102868,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewSubscriptionGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val groupedWithProratedMinimumConfig: @@ -104680,7 +103284,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -104693,7 +103297,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -104721,41 +103325,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithProratedMinimumPrice: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - name = newSubscriptionGroupedWithProratedMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = + apply { + cadence = groupedWithProratedMinimum.cadence + groupedWithProratedMinimumConfig = + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + currency = groupedWithProratedMinimum.currency + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata + referenceId = groupedWithProratedMinimum.referenceId + additionalProperties = + groupedWithProratedMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -105136,8 +103729,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -105151,8 +103743,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = - NewSubscriptionGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", @@ -105178,7 +103770,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -106353,7 +104945,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -106363,10 +104955,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewSubscriptionBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -106775,7 +105367,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkWithProrationPrice]. + * [BulkWithProration]. * * The following fields are required: * ```java @@ -106788,7 +105380,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -106813,33 +105405,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice - ) = apply { - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - cadence = newSubscriptionBulkWithProrationPrice.cadence - itemId = newSubscriptionBulkWithProrationPrice.itemId - modelType = newSubscriptionBulkWithProrationPrice.modelType - name = newSubscriptionBulkWithProrationPrice.name - billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - currency = newSubscriptionBulkWithProrationPrice.currency - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionBulkWithProrationPrice.metadata - referenceId = newSubscriptionBulkWithProrationPrice.referenceId - additionalProperties = - newSubscriptionBulkWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + currency = bulkWithProration.currency + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + referenceId = bulkWithProration.referenceId + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = @@ -107213,7 +105796,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -107227,8 +105810,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkWithProrationPrice = - NewSubscriptionBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -107251,7 +105834,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -108425,7 +107008,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -108435,10 +107018,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewSubscriptionScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -108853,7 +107436,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -108866,7 +107449,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -108895,40 +107478,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithUnitPricingPrice: - NewSubscriptionScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithUnitPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithUnitPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithUnitPricingPrice.modelType - name = newSubscriptionScalableMatrixWithUnitPricingPrice.name + cadence = scalableMatrixWithUnitPricing.cadence + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name scalableMatrixWithUnitPricingConfig = - newSubscriptionScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithUnitPricingPrice.billedInAdvance + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithUnitPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithUnitPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithUnitPricingPrice.invoiceGroupingKey + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + currency = scalableMatrixWithUnitPricing.currency + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithUnitPricingPrice.metadata - referenceId = newSubscriptionScalableMatrixWithUnitPricingPrice.referenceId + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata + referenceId = scalableMatrixWithUnitPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -109312,8 +107884,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -109327,8 +107898,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithUnitPricingPrice = - NewSubscriptionScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -109354,7 +107925,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -110531,7 +109102,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -110541,10 +109112,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -110959,7 +109530,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -110972,7 +109543,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -111001,41 +109572,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithTieredPricingPrice: - NewSubscriptionScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithTieredPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithTieredPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithTieredPricingPrice.modelType - name = newSubscriptionScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newSubscriptionScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithTieredPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithTieredPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + currency = scalableMatrixWithTieredPricing.currency + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithTieredPricingPrice.metadata - referenceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.referenceId + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata + referenceId = scalableMatrixWithTieredPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -111419,8 +109978,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -111434,8 +109992,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithTieredPricingPrice = - NewSubscriptionScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -111461,7 +110019,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -112642,7 +111200,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -112652,10 +111210,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -113065,7 +111623,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -113078,7 +111636,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -113105,35 +111663,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionCumulativeGroupedBulkPrice: - NewSubscriptionCumulativeGroupedBulkPrice - ) = apply { - cadence = newSubscriptionCumulativeGroupedBulkPrice.cadence + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence cumulativeGroupedBulkConfig = - newSubscriptionCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - itemId = newSubscriptionCumulativeGroupedBulkPrice.itemId - modelType = newSubscriptionCumulativeGroupedBulkPrice.modelType - name = newSubscriptionCumulativeGroupedBulkPrice.name - billableMetricId = - newSubscriptionCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newSubscriptionCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionCumulativeGroupedBulkPrice.conversionRate - currency = newSubscriptionCumulativeGroupedBulkPrice.currency - externalPriceId = newSubscriptionCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionCumulativeGroupedBulkPrice.invoiceGroupingKey + cumulativeGroupedBulk.cumulativeGroupedBulkConfig + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + currency = cumulativeGroupedBulk.currency + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newSubscriptionCumulativeGroupedBulkPrice.metadata - referenceId = newSubscriptionCumulativeGroupedBulkPrice.referenceId + cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata + referenceId = cumulativeGroupedBulk.referenceId additionalProperties = - newSubscriptionCumulativeGroupedBulkPrice.additionalProperties - .toMutableMap() + cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -113509,7 +112059,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -113523,8 +112073,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionCumulativeGroupedBulkPrice = - NewSubscriptionCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired( "cumulativeGroupedBulkConfig", @@ -113550,7 +112100,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -114725,7 +113275,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -114735,10 +113285,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" } - class NewSubscriptionMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -115148,7 +113698,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -115161,7 +113711,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -115188,35 +113738,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMaxGroupTieredPackagePrice: - NewSubscriptionMaxGroupTieredPackagePrice - ) = apply { - cadence = newSubscriptionMaxGroupTieredPackagePrice.cadence - itemId = newSubscriptionMaxGroupTieredPackagePrice.itemId + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + itemId = maxGroupTieredPackage.itemId maxGroupTieredPackageConfig = - newSubscriptionMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newSubscriptionMaxGroupTieredPackagePrice.modelType - name = newSubscriptionMaxGroupTieredPackagePrice.name - billableMetricId = - newSubscriptionMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionMaxGroupTieredPackagePrice.conversionRate - currency = newSubscriptionMaxGroupTieredPackagePrice.currency - externalPriceId = newSubscriptionMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMaxGroupTieredPackagePrice.invoiceGroupingKey + maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + currency = maxGroupTieredPackage.currency + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionMaxGroupTieredPackagePrice.metadata - referenceId = newSubscriptionMaxGroupTieredPackagePrice.referenceId + maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata + referenceId = maxGroupTieredPackage.referenceId additionalProperties = - newSubscriptionMaxGroupTieredPackagePrice.additionalProperties - .toMutableMap() + maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -115592,7 +114134,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -115606,8 +114148,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMaxGroupTieredPackagePrice = - NewSubscriptionMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -115633,7 +114175,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -116808,7 +115350,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -116818,10 +115360,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" + "MaxGroupTieredPackage{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" } - class NewSubscriptionGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val groupedWithMeteredMinimumConfig: @@ -117234,7 +115776,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -117247,7 +115789,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -117275,41 +115817,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithMeteredMinimumPrice: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithMeteredMinimumPrice.cadence - groupedWithMeteredMinimumConfig = - newSubscriptionGroupedWithMeteredMinimumPrice - .groupedWithMeteredMinimumConfig - itemId = newSubscriptionGroupedWithMeteredMinimumPrice.itemId - modelType = newSubscriptionGroupedWithMeteredMinimumPrice.modelType - name = newSubscriptionGroupedWithMeteredMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithMeteredMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithMeteredMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithMeteredMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithMeteredMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithMeteredMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithMeteredMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + apply { + cadence = groupedWithMeteredMinimum.cadence + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + currency = groupedWithMeteredMinimum.currency + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata + referenceId = groupedWithMeteredMinimum.referenceId + additionalProperties = + groupedWithMeteredMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -117689,8 +116220,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -117704,8 +116234,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithMeteredMinimumPrice = - NewSubscriptionGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithMeteredMinimumConfig", @@ -117731,7 +116261,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -118906,7 +117436,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithMeteredMinimumPrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -118916,10 +117446,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithMeteredMinimumPrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimum{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -119329,7 +117859,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -119342,7 +117872,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -119369,35 +117899,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMatrixWithDisplayNamePrice: - NewSubscriptionMatrixWithDisplayNamePrice - ) = apply { - cadence = newSubscriptionMatrixWithDisplayNamePrice.cadence - itemId = newSubscriptionMatrixWithDisplayNamePrice.itemId + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + itemId = matrixWithDisplayName.itemId matrixWithDisplayNameConfig = - newSubscriptionMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newSubscriptionMatrixWithDisplayNamePrice.modelType - name = newSubscriptionMatrixWithDisplayNamePrice.name - billableMetricId = - newSubscriptionMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newSubscriptionMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixWithDisplayNamePrice.conversionRate - currency = newSubscriptionMatrixWithDisplayNamePrice.currency - externalPriceId = newSubscriptionMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMatrixWithDisplayNamePrice.invoiceGroupingKey + matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + currency = matrixWithDisplayName.currency + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newSubscriptionMatrixWithDisplayNamePrice.metadata - referenceId = newSubscriptionMatrixWithDisplayNamePrice.referenceId + matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata + referenceId = matrixWithDisplayName.referenceId additionalProperties = - newSubscriptionMatrixWithDisplayNamePrice.additionalProperties - .toMutableMap() + matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -119773,7 +118295,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -119787,8 +118309,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixWithDisplayNamePrice = - NewSubscriptionMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -119814,7 +118336,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -120989,7 +119511,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixWithDisplayNamePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -120999,10 +119521,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixWithDisplayNamePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "MatrixWithDisplayName{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, @@ -121412,7 +119934,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedTieredPackagePrice]. + * [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -121425,7 +119947,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -121451,34 +119973,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedTieredPackagePrice: - NewSubscriptionGroupedTieredPackagePrice - ) = apply { - cadence = newSubscriptionGroupedTieredPackagePrice.cadence - groupedTieredPackageConfig = - newSubscriptionGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newSubscriptionGroupedTieredPackagePrice.itemId - modelType = newSubscriptionGroupedTieredPackagePrice.modelType - name = newSubscriptionGroupedTieredPackagePrice.name - billableMetricId = newSubscriptionGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedTieredPackagePrice.conversionRate - currency = newSubscriptionGroupedTieredPackagePrice.currency - externalPriceId = newSubscriptionGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedTieredPackagePrice.invoiceGroupingKey + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + currency = groupedTieredPackage.currency + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedTieredPackagePrice.metadata - referenceId = newSubscriptionGroupedTieredPackagePrice.referenceId + groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata + referenceId = groupedTieredPackage.referenceId additionalProperties = - newSubscriptionGroupedTieredPackagePrice.additionalProperties - .toMutableMap() + groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -121854,7 +120368,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -121868,8 +120382,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedTieredPackagePrice = - NewSubscriptionGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), @@ -121892,7 +120406,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -123066,7 +121580,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedTieredPackagePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackage && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -123076,7 +121590,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedTieredPackagePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedTieredPackage{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } 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 a3081ba95..70902a8fa 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 @@ -1056,17 +1056,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1710,41 +1710,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1893,66 +1880,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1965,34 +1942,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2017,25 +1986,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2046,21 +2009,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2068,27 +2029,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2097,21 +2051,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2137,44 +2085,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2190,23 +2123,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2387,8 +2316,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2403,7 +2331,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2416,21 +2344,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2591,7 +2514,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2607,8 +2530,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2624,7 +2547,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2676,7 +2599,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2686,10 +2609,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2870,8 +2793,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2886,7 +2808,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2899,21 +2821,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3074,7 +2991,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3090,8 +3007,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3107,7 +3024,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3159,7 +3076,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3169,10 +3086,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3355,7 +3272,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3370,7 +3287,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3383,23 +3300,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3560,7 +3471,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3576,8 +3487,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3593,7 +3504,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3645,7 +3556,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3655,10 +3566,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3861,8 +3772,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3878,7 +3788,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3892,22 +3802,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4079,7 +3984,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4096,8 +4001,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4114,7 +4019,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4166,7 +4071,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4176,10 +4081,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4360,8 +4265,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4376,7 +4280,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4389,21 +4293,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4563,7 +4462,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4579,8 +4478,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4596,7 +4495,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4646,7 +4545,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4656,7 +4555,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4949,17 +4848,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4967,11 +4866,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -4992,15 +4891,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5026,12 +4925,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5058,14 +4956,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5074,11 +4970,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5104,17 +5000,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5141,7 +5037,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5305,8 +5201,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5320,7 +5215,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5332,17 +5227,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5485,7 +5378,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5500,8 +5393,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5518,7 +5411,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5564,7 +5457,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5574,10 +5467,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5741,8 +5634,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5756,7 +5648,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5768,19 +5660,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5925,7 +5813,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5940,8 +5828,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5958,7 +5846,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6004,7 +5892,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6014,10 +5902,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6182,8 +6070,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6197,7 +6084,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6209,16 +6096,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6364,7 +6250,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6379,8 +6265,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6397,7 +6283,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6443,7 +6329,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6453,7 +6339,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8253,142 +8139,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 edb2779ce..2a47bb518 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 @@ -655,156 +655,154 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = - price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with * `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** * Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** * Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** * Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice - ) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** The price the cost is associated with */ 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 0760beb50..c96fa71ce 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 @@ -1313,75 +1313,50 @@ private constructor( } } - /** - * Alias for calling [addDiscount] with - * `Discount.ofAmountDiscountCreationParams(amountDiscountCreationParams)`. - */ - fun addDiscount(amountDiscountCreationParams: Discount.AmountDiscountCreationParams) = - addDiscount(Discount.ofAmountDiscountCreationParams(amountDiscountCreationParams)) + /** Alias for calling [addDiscount] with `Discount.ofAmount(amount)`. */ + fun addDiscount(amount: Discount.Amount) = addDiscount(Discount.ofAmount(amount)) /** * Alias for calling [addDiscount] with the following: * ```java - * Discount.AmountDiscountCreationParams.builder() + * Discount.Amount.builder() * .amountDiscount(amountDiscount) * .build() * ``` */ - fun addAmountDiscountCreationParamsDiscount(amountDiscount: Double) = - addDiscount( - Discount.AmountDiscountCreationParams.builder() - .amountDiscount(amountDiscount) - .build() - ) + fun addAmountDiscount(amountDiscount: Double) = + addDiscount(Discount.Amount.builder().amountDiscount(amountDiscount).build()) - /** - * Alias for calling [addDiscount] with - * `Discount.ofPercentageDiscountCreationParams(percentageDiscountCreationParams)`. - */ - fun addDiscount( - percentageDiscountCreationParams: Discount.PercentageDiscountCreationParams - ) = - addDiscount( - Discount.ofPercentageDiscountCreationParams(percentageDiscountCreationParams) - ) + /** Alias for calling [addDiscount] with `Discount.ofPercentage(percentage)`. */ + fun addDiscount(percentage: Discount.Percentage) = + addDiscount(Discount.ofPercentage(percentage)) /** * Alias for calling [addDiscount] with the following: * ```java - * Discount.PercentageDiscountCreationParams.builder() + * Discount.Percentage.builder() * .percentageDiscount(percentageDiscount) * .build() * ``` */ - fun addPercentageDiscountCreationParamsDiscount(percentageDiscount: Double) = + fun addPercentageDiscount(percentageDiscount: Double) = addDiscount( - Discount.PercentageDiscountCreationParams.builder() - .percentageDiscount(percentageDiscount) - .build() + Discount.Percentage.builder().percentageDiscount(percentageDiscount).build() ) - /** - * Alias for calling [addDiscount] with - * `Discount.ofUsageDiscountCreationParams(usageDiscountCreationParams)`. - */ - fun addDiscount(usageDiscountCreationParams: Discount.UsageDiscountCreationParams) = - addDiscount(Discount.ofUsageDiscountCreationParams(usageDiscountCreationParams)) + /** Alias for calling [addDiscount] with `Discount.ofUsage(usage)`. */ + fun addDiscount(usage: Discount.Usage) = addDiscount(Discount.ofUsage(usage)) /** * Alias for calling [addDiscount] with the following: * ```java - * Discount.UsageDiscountCreationParams.builder() + * Discount.Usage.builder() * .usageDiscount(usageDiscount) * .build() * ``` */ - fun addUsageDiscountCreationParamsDiscount(usageDiscount: Double) = - addDiscount( - Discount.UsageDiscountCreationParams.builder() - .usageDiscount(usageDiscount) - .build() - ) + fun addUsageDiscount(usageDiscount: Double) = + addDiscount(Discount.Usage.builder().usageDiscount(usageDiscount).build()) /** * The end date of the price interval. This is the date that the price will stop billing @@ -1564,215 +1539,144 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** Alias for calling [price] with `Price.ofNewFloatingUnit(newFloatingUnit)`. */ - fun price(newFloatingUnit: Price.NewFloatingUnitPrice) = - price(Price.ofNewFloatingUnit(newFloatingUnit)) + /** Alias for calling [price] with `Price.ofUnit(unit)`. */ + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofNewFloatingPackage(newFloatingPackage)`. */ - fun price(newFloatingPackage: Price.NewFloatingPackagePrice) = - price(Price.ofNewFloatingPackage(newFloatingPackage)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) - /** Alias for calling [price] with `Price.ofNewFloatingMatrix(newFloatingMatrix)`. */ - fun price(newFloatingMatrix: Price.NewFloatingMatrixPrice) = - price(Price.ofNewFloatingMatrix(newFloatingMatrix)) + /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** - * Alias for calling [price] with - * `Price.ofNewFloatingMatrixWithAllocation(newFloatingMatrixWithAllocation)`. + * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(newFloatingMatrixWithAllocation: Price.NewFloatingMatrixWithAllocationPrice) = - price(Price.ofNewFloatingMatrixWithAllocation(newFloatingMatrixWithAllocation)) + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = + price(Price.ofMatrixWithAllocation(matrixWithAllocation)) - /** Alias for calling [price] with `Price.ofNewFloatingTiered(newFloatingTiered)`. */ - fun price(newFloatingTiered: Price.NewFloatingTieredPrice) = - price(Price.ofNewFloatingTiered(newFloatingTiered)) + /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) - /** - * Alias for calling [price] with `Price.ofNewFloatingTieredBps(newFloatingTieredBps)`. - */ - fun price(newFloatingTieredBps: Price.NewFloatingTieredBpsPrice) = - price(Price.ofNewFloatingTieredBps(newFloatingTieredBps)) + /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) - /** Alias for calling [price] with `Price.ofNewFloatingBps(newFloatingBps)`. */ - fun price(newFloatingBps: Price.NewFloatingBpsPrice) = - price(Price.ofNewFloatingBps(newFloatingBps)) + /** Alias for calling [price] with `Price.ofBps(bps)`. */ + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) - /** Alias for calling [price] with `Price.ofNewFloatingBulkBps(newFloatingBulkBps)`. */ - fun price(newFloatingBulkBps: Price.NewFloatingBulkBpsPrice) = - price(Price.ofNewFloatingBulkBps(newFloatingBulkBps)) + /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) - /** Alias for calling [price] with `Price.ofNewFloatingBulk(newFloatingBulk)`. */ - fun price(newFloatingBulk: Price.NewFloatingBulkPrice) = - price(Price.ofNewFloatingBulk(newFloatingBulk)) + /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** - * Alias for calling [price] with - * `Price.ofNewFloatingThresholdTotalAmount(newFloatingThresholdTotalAmount)`. + * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(newFloatingThresholdTotalAmount: Price.NewFloatingThresholdTotalAmountPrice) = - price(Price.ofNewFloatingThresholdTotalAmount(newFloatingThresholdTotalAmount)) + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = + price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingTieredPackage(newFloatingTieredPackage)`. - */ - fun price(newFloatingTieredPackage: Price.NewFloatingTieredPackagePrice) = - price(Price.ofNewFloatingTieredPackage(newFloatingTieredPackage)) + /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ + fun price(tieredPackage: Price.TieredPackage) = + price(Price.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingGroupedTiered(newFloatingGroupedTiered)`. - */ - fun price(newFloatingGroupedTiered: Price.NewFloatingGroupedTieredPrice) = - price(Price.ofNewFloatingGroupedTiered(newFloatingGroupedTiered)) + /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ + fun price(groupedTiered: Price.GroupedTiered) = + price(Price.ofGroupedTiered(groupedTiered)) /** * Alias for calling [price] with - * `Price.ofNewFloatingMaxGroupTieredPackage(newFloatingMaxGroupTieredPackage)`. + * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price( - newFloatingMaxGroupTieredPackage: Price.NewFloatingMaxGroupTieredPackagePrice - ) = price(Price.ofNewFloatingMaxGroupTieredPackage(newFloatingMaxGroupTieredPackage)) + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = + price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingTieredWithMinimum(newFloatingTieredWithMinimum)`. - */ - fun price(newFloatingTieredWithMinimum: Price.NewFloatingTieredWithMinimumPrice) = - price(Price.ofNewFloatingTieredWithMinimum(newFloatingTieredWithMinimum)) + /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun price(tieredWithMinimum: Price.TieredWithMinimum) = + price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with - * `Price.ofNewFloatingPackageWithAllocation(newFloatingPackageWithAllocation)`. + * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price( - newFloatingPackageWithAllocation: Price.NewFloatingPackageWithAllocationPrice - ) = price(Price.ofNewFloatingPackageWithAllocation(newFloatingPackageWithAllocation)) + fun price(packageWithAllocation: Price.PackageWithAllocation) = + price(Price.ofPackageWithAllocation(packageWithAllocation)) /** * Alias for calling [price] with - * `Price.ofNewFloatingTieredPackageWithMinimum(newFloatingTieredPackageWithMinimum)`. + * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price( - newFloatingTieredPackageWithMinimum: Price.NewFloatingTieredPackageWithMinimumPrice - ) = - price( - Price.ofNewFloatingTieredPackageWithMinimum(newFloatingTieredPackageWithMinimum) - ) + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = + price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingUnitWithPercent(newFloatingUnitWithPercent)`. - */ - fun price(newFloatingUnitWithPercent: Price.NewFloatingUnitWithPercentPrice) = - price(Price.ofNewFloatingUnitWithPercent(newFloatingUnitWithPercent)) + /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun price(unitWithPercent: Price.UnitWithPercent) = + price(Price.ofUnitWithPercent(unitWithPercent)) /** - * Alias for calling [price] with - * `Price.ofNewFloatingTieredWithProration(newFloatingTieredWithProration)`. + * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(newFloatingTieredWithProration: Price.NewFloatingTieredWithProrationPrice) = - price(Price.ofNewFloatingTieredWithProration(newFloatingTieredWithProration)) + fun price(tieredWithProration: Price.TieredWithProration) = + price(Price.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingUnitWithProration(newFloatingUnitWithProration)`. - */ - fun price(newFloatingUnitWithProration: Price.NewFloatingUnitWithProrationPrice) = - price(Price.ofNewFloatingUnitWithProration(newFloatingUnitWithProration)) + /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun price(unitWithProration: Price.UnitWithProration) = + price(Price.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingGroupedAllocation(newFloatingGroupedAllocation)`. - */ - fun price(newFloatingGroupedAllocation: Price.NewFloatingGroupedAllocationPrice) = - price(Price.ofNewFloatingGroupedAllocation(newFloatingGroupedAllocation)) + /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun price(groupedAllocation: Price.GroupedAllocation) = + price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with - * `Price.ofNewFloatingGroupedWithProratedMinimum(newFloatingGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price( - newFloatingGroupedWithProratedMinimum: - Price.NewFloatingGroupedWithProratedMinimumPrice - ) = - price( - Price.ofNewFloatingGroupedWithProratedMinimum( - newFloatingGroupedWithProratedMinimum - ) - ) + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = + price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with - * `Price.ofNewFloatingGroupedWithMeteredMinimum(newFloatingGroupedWithMeteredMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price( - newFloatingGroupedWithMeteredMinimum: - Price.NewFloatingGroupedWithMeteredMinimumPrice - ) = - price( - Price.ofNewFloatingGroupedWithMeteredMinimum( - newFloatingGroupedWithMeteredMinimum - ) - ) + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = + price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with - * `Price.ofNewFloatingMatrixWithDisplayName(newFloatingMatrixWithDisplayName)`. + * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price( - newFloatingMatrixWithDisplayName: Price.NewFloatingMatrixWithDisplayNamePrice - ) = price(Price.ofNewFloatingMatrixWithDisplayName(newFloatingMatrixWithDisplayName)) + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = + price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) - /** - * Alias for calling [price] with - * `Price.ofNewFloatingBulkWithProration(newFloatingBulkWithProration)`. - */ - fun price(newFloatingBulkWithProration: Price.NewFloatingBulkWithProrationPrice) = - price(Price.ofNewFloatingBulkWithProration(newFloatingBulkWithProration)) + /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun price(bulkWithProration: Price.BulkWithProration) = + price(Price.ofBulkWithProration(bulkWithProration)) /** - * Alias for calling [price] with - * `Price.ofNewFloatingGroupedTieredPackage(newFloatingGroupedTieredPackage)`. + * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(newFloatingGroupedTieredPackage: Price.NewFloatingGroupedTieredPackagePrice) = - price(Price.ofNewFloatingGroupedTieredPackage(newFloatingGroupedTieredPackage)) + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = + price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with - * `Price.ofNewFloatingScalableMatrixWithUnitPricing(newFloatingScalableMatrixWithUnitPricing)`. + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price( - newFloatingScalableMatrixWithUnitPricing: - Price.NewFloatingScalableMatrixWithUnitPricingPrice - ) = - price( - Price.ofNewFloatingScalableMatrixWithUnitPricing( - newFloatingScalableMatrixWithUnitPricing - ) - ) + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = + price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with - * `Price.ofNewFloatingScalableMatrixWithTieredPricing(newFloatingScalableMatrixWithTieredPricing)`. + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - newFloatingScalableMatrixWithTieredPricing: - Price.NewFloatingScalableMatrixWithTieredPricingPrice - ) = - price( - Price.ofNewFloatingScalableMatrixWithTieredPricing( - newFloatingScalableMatrixWithTieredPricing - ) - ) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with - * `Price.ofNewFloatingCumulativeGroupedBulk(newFloatingCumulativeGroupedBulk)`. + * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price( - newFloatingCumulativeGroupedBulk: Price.NewFloatingCumulativeGroupedBulkPrice - ) = price(Price.ofNewFloatingCumulativeGroupedBulk(newFloatingCumulativeGroupedBulk)) + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = + price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** The id of the price to add to the subscription. */ fun priceId(priceId: String?) = priceId(JsonField.ofNullable(priceId)) @@ -2578,49 +2482,37 @@ private constructor( @JsonSerialize(using = Discount.Serializer::class) class Discount private constructor( - private val amountDiscountCreationParams: AmountDiscountCreationParams? = null, - private val percentageDiscountCreationParams: PercentageDiscountCreationParams? = null, - private val usageDiscountCreationParams: UsageDiscountCreationParams? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amountDiscountCreationParams(): Optional = - Optional.ofNullable(amountDiscountCreationParams) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentageDiscountCreationParams(): Optional = - Optional.ofNullable(percentageDiscountCreationParams) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usageDiscountCreationParams(): Optional = - Optional.ofNullable(usageDiscountCreationParams) + fun usage(): Optional = Optional.ofNullable(usage) - fun isAmountDiscountCreationParams(): Boolean = amountDiscountCreationParams != null + fun isAmount(): Boolean = amount != null - fun isPercentageDiscountCreationParams(): Boolean = - percentageDiscountCreationParams != null + fun isPercentage(): Boolean = percentage != null - fun isUsageDiscountCreationParams(): Boolean = usageDiscountCreationParams != null + fun isUsage(): Boolean = usage != null - fun asAmountDiscountCreationParams(): AmountDiscountCreationParams = - amountDiscountCreationParams.getOrThrow("amountDiscountCreationParams") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentageDiscountCreationParams(): PercentageDiscountCreationParams = - percentageDiscountCreationParams.getOrThrow("percentageDiscountCreationParams") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsageDiscountCreationParams(): UsageDiscountCreationParams = - usageDiscountCreationParams.getOrThrow("usageDiscountCreationParams") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - amountDiscountCreationParams != null -> - visitor.visitAmountDiscountCreationParams(amountDiscountCreationParams) - percentageDiscountCreationParams != null -> - visitor.visitPercentageDiscountCreationParams( - percentageDiscountCreationParams - ) - usageDiscountCreationParams != null -> - visitor.visitUsageDiscountCreationParams(usageDiscountCreationParams) + amount != null -> visitor.visitAmount(amount) + percentage != null -> visitor.visitPercentage(percentage) + usage != null -> visitor.visitUsage(usage) else -> visitor.unknown(_json) } @@ -2633,22 +2525,16 @@ private constructor( accept( object : Visitor { - override fun visitAmountDiscountCreationParams( - amountDiscountCreationParams: AmountDiscountCreationParams - ) { - amountDiscountCreationParams.validate() + override fun visitAmount(amount: Amount) { + amount.validate() } - override fun visitPercentageDiscountCreationParams( - percentageDiscountCreationParams: PercentageDiscountCreationParams - ) { - percentageDiscountCreationParams.validate() + override fun visitPercentage(percentage: Percentage) { + percentage.validate() } - override fun visitUsageDiscountCreationParams( - usageDiscountCreationParams: UsageDiscountCreationParams - ) { - usageDiscountCreationParams.validate() + override fun visitUsage(usage: Usage) { + usage.validate() } } ) @@ -2673,17 +2559,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmountDiscountCreationParams( - amountDiscountCreationParams: AmountDiscountCreationParams - ) = amountDiscountCreationParams.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentageDiscountCreationParams( - percentageDiscountCreationParams: PercentageDiscountCreationParams - ) = percentageDiscountCreationParams.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsageDiscountCreationParams( - usageDiscountCreationParams: UsageDiscountCreationParams - ) = usageDiscountCreationParams.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2694,39 +2574,28 @@ private constructor( return true } - return /* spotless:off */ other is Discount && amountDiscountCreationParams == other.amountDiscountCreationParams && percentageDiscountCreationParams == other.percentageDiscountCreationParams && usageDiscountCreationParams == other.usageDiscountCreationParams /* spotless:on */ + return /* spotless:off */ other is Discount && amount == other.amount && percentage == other.percentage && usage == other.usage /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(amountDiscountCreationParams, percentageDiscountCreationParams, usageDiscountCreationParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(amount, percentage, usage) /* spotless:on */ override fun toString(): String = when { - amountDiscountCreationParams != null -> - "Discount{amountDiscountCreationParams=$amountDiscountCreationParams}" - percentageDiscountCreationParams != null -> - "Discount{percentageDiscountCreationParams=$percentageDiscountCreationParams}" - usageDiscountCreationParams != null -> - "Discount{usageDiscountCreationParams=$usageDiscountCreationParams}" + amount != null -> "Discount{amount=$amount}" + percentage != null -> "Discount{percentage=$percentage}" + usage != null -> "Discount{usage=$usage}" _json != null -> "Discount{_unknown=$_json}" else -> throw IllegalStateException("Invalid Discount") } companion object { - @JvmStatic - fun ofAmountDiscountCreationParams( - amountDiscountCreationParams: AmountDiscountCreationParams - ) = Discount(amountDiscountCreationParams = amountDiscountCreationParams) + @JvmStatic fun ofAmount(amount: Amount) = Discount(amount = amount) @JvmStatic - fun ofPercentageDiscountCreationParams( - percentageDiscountCreationParams: PercentageDiscountCreationParams - ) = Discount(percentageDiscountCreationParams = percentageDiscountCreationParams) + fun ofPercentage(percentage: Percentage) = Discount(percentage = percentage) - @JvmStatic - fun ofUsageDiscountCreationParams( - usageDiscountCreationParams: UsageDiscountCreationParams - ) = Discount(usageDiscountCreationParams = usageDiscountCreationParams) + @JvmStatic fun ofUsage(usage: Usage) = Discount(usage = usage) } /** @@ -2735,17 +2604,11 @@ private constructor( */ interface Visitor { - fun visitAmountDiscountCreationParams( - amountDiscountCreationParams: AmountDiscountCreationParams - ): T + fun visitAmount(amount: Amount): T - fun visitPercentageDiscountCreationParams( - percentageDiscountCreationParams: PercentageDiscountCreationParams - ): T + fun visitPercentage(percentage: Percentage): T - fun visitUsageDiscountCreationParams( - usageDiscountCreationParams: UsageDiscountCreationParams - ): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [Discount] to a value of type [T]. @@ -2771,29 +2634,19 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Discount(amountDiscountCreationParams = it, _json = json) } - ?: Discount(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Discount(amount = it, _json = json) + } ?: Discount(_json = json) } "percentage" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Discount(percentageDiscountCreationParams = it, _json = json) - } ?: Discount(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Discount(percentage = it, _json = json) + } ?: Discount(_json = json) } "usage" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Discount(usageDiscountCreationParams = it, _json = json) } - ?: Discount(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Discount(usage = it, _json = json) + } ?: Discount(_json = json) } } @@ -2809,19 +2662,16 @@ private constructor( provider: SerializerProvider, ) { when { - value.amountDiscountCreationParams != null -> - generator.writeObject(value.amountDiscountCreationParams) - value.percentageDiscountCreationParams != null -> - generator.writeObject(value.percentageDiscountCreationParams) - value.usageDiscountCreationParams != null -> - generator.writeObject(value.usageDiscountCreationParams) + value.amount != null -> generator.writeObject(value.amount) + value.percentage != null -> generator.writeObject(value.percentage) + value.usage != null -> generator.writeObject(value.usage) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Discount") } } } - class AmountDiscountCreationParams + class Amount private constructor( private val amountDiscount: JsonField, private val discountType: JsonValue, @@ -2885,8 +2735,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountCreationParams]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -2896,7 +2745,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountCreationParams]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -2904,13 +2753,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountCreationParams: AmountDiscountCreationParams) = - apply { - amountDiscount = amountDiscountCreationParams.amountDiscount - discountType = amountDiscountCreationParams.discountType - additionalProperties = - amountDiscountCreationParams.additionalProperties.toMutableMap() - } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + discountType = amount.discountType + additionalProperties = amount.additionalProperties.toMutableMap() + } /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: Double) = @@ -2966,7 +2813,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountCreationParams]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2977,8 +2824,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountCreationParams = - AmountDiscountCreationParams( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), discountType, additionalProperties.toMutableMap(), @@ -2987,7 +2834,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountCreationParams = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -3025,7 +2872,7 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountCreationParams && amountDiscount == other.amountDiscount && discountType == other.discountType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Amount && amountDiscount == other.amountDiscount && discountType == other.discountType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -3035,10 +2882,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountCreationParams{amountDiscount=$amountDiscount, discountType=$discountType, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, discountType=$discountType, additionalProperties=$additionalProperties}" } - class PercentageDiscountCreationParams + class Percentage private constructor( private val discountType: JsonValue, private val percentageDiscount: JsonField, @@ -3104,8 +2951,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountCreationParams]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -3115,7 +2961,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountCreationParams]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var discountType: JsonValue = JsonValue.from("percentage") @@ -3123,13 +2969,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - percentageDiscountCreationParams: PercentageDiscountCreationParams - ) = apply { - discountType = percentageDiscountCreationParams.discountType - percentageDiscount = percentageDiscountCreationParams.percentageDiscount - additionalProperties = - percentageDiscountCreationParams.additionalProperties.toMutableMap() + internal fun from(percentage: Percentage) = apply { + discountType = percentage.discountType + percentageDiscount = percentage.percentageDiscount + additionalProperties = percentage.additionalProperties.toMutableMap() } /** @@ -3189,7 +3032,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountCreationParams]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3200,8 +3043,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountCreationParams = - PercentageDiscountCreationParams( + fun build(): Percentage = + Percentage( discountType, checkRequired("percentageDiscount", percentageDiscount), additionalProperties.toMutableMap(), @@ -3210,7 +3053,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountCreationParams = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -3248,7 +3091,7 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountCreationParams && discountType == other.discountType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Percentage && discountType == other.discountType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -3258,10 +3101,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountCreationParams{discountType=$discountType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "Percentage{discountType=$discountType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" } - class UsageDiscountCreationParams + class Usage private constructor( private val discountType: JsonValue, private val usageDiscount: JsonField, @@ -3326,8 +3169,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountCreationParams]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -3337,7 +3179,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountCreationParams]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var discountType: JsonValue = JsonValue.from("usage") @@ -3345,13 +3187,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountCreationParams: UsageDiscountCreationParams) = - apply { - discountType = usageDiscountCreationParams.discountType - usageDiscount = usageDiscountCreationParams.usageDiscount - additionalProperties = - usageDiscountCreationParams.additionalProperties.toMutableMap() - } + internal fun from(usage: Usage) = apply { + discountType = usage.discountType + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() + } /** * Sets the field to an arbitrary JSON value. @@ -3410,7 +3250,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountCreationParams]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3421,8 +3261,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountCreationParams = - UsageDiscountCreationParams( + fun build(): Usage = + Usage( discountType, checkRequired("usageDiscount", usageDiscount), additionalProperties.toMutableMap(), @@ -3431,7 +3271,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountCreationParams = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -3469,7 +3309,7 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountCreationParams && discountType == other.discountType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Usage && discountType == other.discountType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -3479,7 +3319,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountCreationParams{discountType=$discountType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{discountType=$discountType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3888,392 +3728,287 @@ private constructor( @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val newFloatingUnit: NewFloatingUnitPrice? = null, - private val newFloatingPackage: NewFloatingPackagePrice? = null, - private val newFloatingMatrix: NewFloatingMatrixPrice? = null, - private val newFloatingMatrixWithAllocation: NewFloatingMatrixWithAllocationPrice? = - null, - private val newFloatingTiered: NewFloatingTieredPrice? = null, - private val newFloatingTieredBps: NewFloatingTieredBpsPrice? = null, - private val newFloatingBps: NewFloatingBpsPrice? = null, - private val newFloatingBulkBps: NewFloatingBulkBpsPrice? = null, - private val newFloatingBulk: NewFloatingBulkPrice? = null, - private val newFloatingThresholdTotalAmount: NewFloatingThresholdTotalAmountPrice? = - null, - private val newFloatingTieredPackage: NewFloatingTieredPackagePrice? = null, - private val newFloatingGroupedTiered: NewFloatingGroupedTieredPrice? = null, - private val newFloatingMaxGroupTieredPackage: NewFloatingMaxGroupTieredPackagePrice? = - null, - private val newFloatingTieredWithMinimum: NewFloatingTieredWithMinimumPrice? = null, - private val newFloatingPackageWithAllocation: NewFloatingPackageWithAllocationPrice? = - null, - private val newFloatingTieredPackageWithMinimum: - NewFloatingTieredPackageWithMinimumPrice? = - null, - private val newFloatingUnitWithPercent: NewFloatingUnitWithPercentPrice? = null, - private val newFloatingTieredWithProration: NewFloatingTieredWithProrationPrice? = null, - private val newFloatingUnitWithProration: NewFloatingUnitWithProrationPrice? = null, - private val newFloatingGroupedAllocation: NewFloatingGroupedAllocationPrice? = null, - private val newFloatingGroupedWithProratedMinimum: - NewFloatingGroupedWithProratedMinimumPrice? = - null, - private val newFloatingGroupedWithMeteredMinimum: - NewFloatingGroupedWithMeteredMinimumPrice? = - null, - private val newFloatingMatrixWithDisplayName: NewFloatingMatrixWithDisplayNamePrice? = - null, - private val newFloatingBulkWithProration: NewFloatingBulkWithProrationPrice? = null, - private val newFloatingGroupedTieredPackage: NewFloatingGroupedTieredPackagePrice? = - null, - private val newFloatingScalableMatrixWithUnitPricing: - NewFloatingScalableMatrixWithUnitPricingPrice? = - null, - private val newFloatingScalableMatrixWithTieredPricing: - NewFloatingScalableMatrixWithTieredPricingPrice? = - null, - private val newFloatingCumulativeGroupedBulk: NewFloatingCumulativeGroupedBulkPrice? = - null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val matrixWithAllocation: MatrixWithAllocation? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val groupedTiered: GroupedTiered? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredPackageWithMinimum: TieredPackageWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val bulkWithProration: BulkWithProration? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, private val _json: JsonValue? = null, ) { - fun newFloatingUnit(): Optional = - Optional.ofNullable(newFloatingUnit) + fun unit(): Optional = Optional.ofNullable(unit) - fun newFloatingPackage(): Optional = - Optional.ofNullable(newFloatingPackage) + fun package_(): Optional = Optional.ofNullable(package_) - fun newFloatingMatrix(): Optional = - Optional.ofNullable(newFloatingMatrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newFloatingMatrixWithAllocation(): Optional = - Optional.ofNullable(newFloatingMatrixWithAllocation) + fun matrixWithAllocation(): Optional = + Optional.ofNullable(matrixWithAllocation) - fun newFloatingTiered(): Optional = - Optional.ofNullable(newFloatingTiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newFloatingTieredBps(): Optional = - Optional.ofNullable(newFloatingTieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newFloatingBps(): Optional = - Optional.ofNullable(newFloatingBps) + fun bps(): Optional = Optional.ofNullable(bps) - fun newFloatingBulkBps(): Optional = - Optional.ofNullable(newFloatingBulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newFloatingBulk(): Optional = - Optional.ofNullable(newFloatingBulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newFloatingThresholdTotalAmount(): Optional = - Optional.ofNullable(newFloatingThresholdTotalAmount) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newFloatingTieredPackage(): Optional = - Optional.ofNullable(newFloatingTieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newFloatingGroupedTiered(): Optional = - Optional.ofNullable(newFloatingGroupedTiered) + fun groupedTiered(): Optional = Optional.ofNullable(groupedTiered) - fun newFloatingMaxGroupTieredPackage(): - Optional = - Optional.ofNullable(newFloatingMaxGroupTieredPackage) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newFloatingTieredWithMinimum(): Optional = - Optional.ofNullable(newFloatingTieredWithMinimum) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newFloatingPackageWithAllocation(): - Optional = - Optional.ofNullable(newFloatingPackageWithAllocation) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newFloatingTieredPackageWithMinimum(): - Optional = - Optional.ofNullable(newFloatingTieredPackageWithMinimum) + fun tieredPackageWithMinimum(): Optional = + Optional.ofNullable(tieredPackageWithMinimum) - fun newFloatingUnitWithPercent(): Optional = - Optional.ofNullable(newFloatingUnitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newFloatingTieredWithProration(): Optional = - Optional.ofNullable(newFloatingTieredWithProration) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newFloatingUnitWithProration(): Optional = - Optional.ofNullable(newFloatingUnitWithProration) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newFloatingGroupedAllocation(): Optional = - Optional.ofNullable(newFloatingGroupedAllocation) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newFloatingGroupedWithProratedMinimum(): - Optional = - Optional.ofNullable(newFloatingGroupedWithProratedMinimum) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newFloatingGroupedWithMeteredMinimum(): - Optional = - Optional.ofNullable(newFloatingGroupedWithMeteredMinimum) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newFloatingMatrixWithDisplayName(): - Optional = - Optional.ofNullable(newFloatingMatrixWithDisplayName) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newFloatingBulkWithProration(): Optional = - Optional.ofNullable(newFloatingBulkWithProration) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newFloatingGroupedTieredPackage(): Optional = - Optional.ofNullable(newFloatingGroupedTieredPackage) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun newFloatingScalableMatrixWithUnitPricing(): - Optional = - Optional.ofNullable(newFloatingScalableMatrixWithUnitPricing) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newFloatingScalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(newFloatingScalableMatrixWithTieredPricing) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newFloatingCumulativeGroupedBulk(): - Optional = - Optional.ofNullable(newFloatingCumulativeGroupedBulk) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun isNewFloatingUnit(): Boolean = newFloatingUnit != null + fun isUnit(): Boolean = unit != null - fun isNewFloatingPackage(): Boolean = newFloatingPackage != null + fun isPackage(): Boolean = package_ != null - fun isNewFloatingMatrix(): Boolean = newFloatingMatrix != null + fun isMatrix(): Boolean = matrix != null - fun isNewFloatingMatrixWithAllocation(): Boolean = - newFloatingMatrixWithAllocation != null + fun isMatrixWithAllocation(): Boolean = matrixWithAllocation != null - fun isNewFloatingTiered(): Boolean = newFloatingTiered != null + fun isTiered(): Boolean = tiered != null - fun isNewFloatingTieredBps(): Boolean = newFloatingTieredBps != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewFloatingBps(): Boolean = newFloatingBps != null + fun isBps(): Boolean = bps != null - fun isNewFloatingBulkBps(): Boolean = newFloatingBulkBps != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewFloatingBulk(): Boolean = newFloatingBulk != null + fun isBulk(): Boolean = bulk != null - fun isNewFloatingThresholdTotalAmount(): Boolean = - newFloatingThresholdTotalAmount != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewFloatingTieredPackage(): Boolean = newFloatingTieredPackage != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewFloatingGroupedTiered(): Boolean = newFloatingGroupedTiered != null + fun isGroupedTiered(): Boolean = groupedTiered != null - fun isNewFloatingMaxGroupTieredPackage(): Boolean = - newFloatingMaxGroupTieredPackage != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewFloatingTieredWithMinimum(): Boolean = newFloatingTieredWithMinimum != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewFloatingPackageWithAllocation(): Boolean = - newFloatingPackageWithAllocation != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewFloatingTieredPackageWithMinimum(): Boolean = - newFloatingTieredPackageWithMinimum != null + fun isTieredPackageWithMinimum(): Boolean = tieredPackageWithMinimum != null - fun isNewFloatingUnitWithPercent(): Boolean = newFloatingUnitWithPercent != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewFloatingTieredWithProration(): Boolean = newFloatingTieredWithProration != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewFloatingUnitWithProration(): Boolean = newFloatingUnitWithProration != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewFloatingGroupedAllocation(): Boolean = newFloatingGroupedAllocation != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewFloatingGroupedWithProratedMinimum(): Boolean = - newFloatingGroupedWithProratedMinimum != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewFloatingGroupedWithMeteredMinimum(): Boolean = - newFloatingGroupedWithMeteredMinimum != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewFloatingMatrixWithDisplayName(): Boolean = - newFloatingMatrixWithDisplayName != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewFloatingBulkWithProration(): Boolean = newFloatingBulkWithProration != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewFloatingGroupedTieredPackage(): Boolean = - newFloatingGroupedTieredPackage != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun isNewFloatingScalableMatrixWithUnitPricing(): Boolean = - newFloatingScalableMatrixWithUnitPricing != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewFloatingScalableMatrixWithTieredPricing(): Boolean = - newFloatingScalableMatrixWithTieredPricing != null + fun isScalableMatrixWithTieredPricing(): Boolean = + scalableMatrixWithTieredPricing != null - fun isNewFloatingCumulativeGroupedBulk(): Boolean = - newFloatingCumulativeGroupedBulk != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun asNewFloatingUnit(): NewFloatingUnitPrice = - newFloatingUnit.getOrThrow("newFloatingUnit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewFloatingPackage(): NewFloatingPackagePrice = - newFloatingPackage.getOrThrow("newFloatingPackage") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewFloatingMatrix(): NewFloatingMatrixPrice = - newFloatingMatrix.getOrThrow("newFloatingMatrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewFloatingMatrixWithAllocation(): NewFloatingMatrixWithAllocationPrice = - newFloatingMatrixWithAllocation.getOrThrow("newFloatingMatrixWithAllocation") + fun asMatrixWithAllocation(): MatrixWithAllocation = + matrixWithAllocation.getOrThrow("matrixWithAllocation") - fun asNewFloatingTiered(): NewFloatingTieredPrice = - newFloatingTiered.getOrThrow("newFloatingTiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewFloatingTieredBps(): NewFloatingTieredBpsPrice = - newFloatingTieredBps.getOrThrow("newFloatingTieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewFloatingBps(): NewFloatingBpsPrice = - newFloatingBps.getOrThrow("newFloatingBps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewFloatingBulkBps(): NewFloatingBulkBpsPrice = - newFloatingBulkBps.getOrThrow("newFloatingBulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewFloatingBulk(): NewFloatingBulkPrice = - newFloatingBulk.getOrThrow("newFloatingBulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewFloatingThresholdTotalAmount(): NewFloatingThresholdTotalAmountPrice = - newFloatingThresholdTotalAmount.getOrThrow("newFloatingThresholdTotalAmount") + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewFloatingTieredPackage(): NewFloatingTieredPackagePrice = - newFloatingTieredPackage.getOrThrow("newFloatingTieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewFloatingGroupedTiered(): NewFloatingGroupedTieredPrice = - newFloatingGroupedTiered.getOrThrow("newFloatingGroupedTiered") + fun asGroupedTiered(): GroupedTiered = groupedTiered.getOrThrow("groupedTiered") - fun asNewFloatingMaxGroupTieredPackage(): NewFloatingMaxGroupTieredPackagePrice = - newFloatingMaxGroupTieredPackage.getOrThrow("newFloatingMaxGroupTieredPackage") + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewFloatingTieredWithMinimum(): NewFloatingTieredWithMinimumPrice = - newFloatingTieredWithMinimum.getOrThrow("newFloatingTieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewFloatingPackageWithAllocation(): NewFloatingPackageWithAllocationPrice = - newFloatingPackageWithAllocation.getOrThrow("newFloatingPackageWithAllocation") + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewFloatingTieredPackageWithMinimum(): NewFloatingTieredPackageWithMinimumPrice = - newFloatingTieredPackageWithMinimum.getOrThrow( - "newFloatingTieredPackageWithMinimum" - ) + fun asTieredPackageWithMinimum(): TieredPackageWithMinimum = + tieredPackageWithMinimum.getOrThrow("tieredPackageWithMinimum") - fun asNewFloatingUnitWithPercent(): NewFloatingUnitWithPercentPrice = - newFloatingUnitWithPercent.getOrThrow("newFloatingUnitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewFloatingTieredWithProration(): NewFloatingTieredWithProrationPrice = - newFloatingTieredWithProration.getOrThrow("newFloatingTieredWithProration") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewFloatingUnitWithProration(): NewFloatingUnitWithProrationPrice = - newFloatingUnitWithProration.getOrThrow("newFloatingUnitWithProration") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewFloatingGroupedAllocation(): NewFloatingGroupedAllocationPrice = - newFloatingGroupedAllocation.getOrThrow("newFloatingGroupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewFloatingGroupedWithProratedMinimum(): - NewFloatingGroupedWithProratedMinimumPrice = - newFloatingGroupedWithProratedMinimum.getOrThrow( - "newFloatingGroupedWithProratedMinimum" - ) + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewFloatingGroupedWithMeteredMinimum(): - NewFloatingGroupedWithMeteredMinimumPrice = - newFloatingGroupedWithMeteredMinimum.getOrThrow( - "newFloatingGroupedWithMeteredMinimum" - ) + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewFloatingMatrixWithDisplayName(): NewFloatingMatrixWithDisplayNamePrice = - newFloatingMatrixWithDisplayName.getOrThrow("newFloatingMatrixWithDisplayName") + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewFloatingBulkWithProration(): NewFloatingBulkWithProrationPrice = - newFloatingBulkWithProration.getOrThrow("newFloatingBulkWithProration") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewFloatingGroupedTieredPackage(): NewFloatingGroupedTieredPackagePrice = - newFloatingGroupedTieredPackage.getOrThrow("newFloatingGroupedTieredPackage") + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") - fun asNewFloatingScalableMatrixWithUnitPricing(): - NewFloatingScalableMatrixWithUnitPricingPrice = - newFloatingScalableMatrixWithUnitPricing.getOrThrow( - "newFloatingScalableMatrixWithUnitPricing" - ) + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewFloatingScalableMatrixWithTieredPricing(): - NewFloatingScalableMatrixWithTieredPricingPrice = - newFloatingScalableMatrixWithTieredPricing.getOrThrow( - "newFloatingScalableMatrixWithTieredPricing" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewFloatingCumulativeGroupedBulk(): NewFloatingCumulativeGroupedBulkPrice = - newFloatingCumulativeGroupedBulk.getOrThrow("newFloatingCumulativeGroupedBulk") + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newFloatingUnit != null -> visitor.visitNewFloatingUnit(newFloatingUnit) - newFloatingPackage != null -> - visitor.visitNewFloatingPackage(newFloatingPackage) - newFloatingMatrix != null -> visitor.visitNewFloatingMatrix(newFloatingMatrix) - newFloatingMatrixWithAllocation != null -> - visitor.visitNewFloatingMatrixWithAllocation( - newFloatingMatrixWithAllocation - ) - newFloatingTiered != null -> visitor.visitNewFloatingTiered(newFloatingTiered) - newFloatingTieredBps != null -> - visitor.visitNewFloatingTieredBps(newFloatingTieredBps) - newFloatingBps != null -> visitor.visitNewFloatingBps(newFloatingBps) - newFloatingBulkBps != null -> - visitor.visitNewFloatingBulkBps(newFloatingBulkBps) - newFloatingBulk != null -> visitor.visitNewFloatingBulk(newFloatingBulk) - newFloatingThresholdTotalAmount != null -> - visitor.visitNewFloatingThresholdTotalAmount( - newFloatingThresholdTotalAmount - ) - newFloatingTieredPackage != null -> - visitor.visitNewFloatingTieredPackage(newFloatingTieredPackage) - newFloatingGroupedTiered != null -> - visitor.visitNewFloatingGroupedTiered(newFloatingGroupedTiered) - newFloatingMaxGroupTieredPackage != null -> - visitor.visitNewFloatingMaxGroupTieredPackage( - newFloatingMaxGroupTieredPackage - ) - newFloatingTieredWithMinimum != null -> - visitor.visitNewFloatingTieredWithMinimum(newFloatingTieredWithMinimum) - newFloatingPackageWithAllocation != null -> - visitor.visitNewFloatingPackageWithAllocation( - newFloatingPackageWithAllocation - ) - newFloatingTieredPackageWithMinimum != null -> - visitor.visitNewFloatingTieredPackageWithMinimum( - newFloatingTieredPackageWithMinimum - ) - newFloatingUnitWithPercent != null -> - visitor.visitNewFloatingUnitWithPercent(newFloatingUnitWithPercent) - newFloatingTieredWithProration != null -> - visitor.visitNewFloatingTieredWithProration(newFloatingTieredWithProration) - newFloatingUnitWithProration != null -> - visitor.visitNewFloatingUnitWithProration(newFloatingUnitWithProration) - newFloatingGroupedAllocation != null -> - visitor.visitNewFloatingGroupedAllocation(newFloatingGroupedAllocation) - newFloatingGroupedWithProratedMinimum != null -> - visitor.visitNewFloatingGroupedWithProratedMinimum( - newFloatingGroupedWithProratedMinimum - ) - newFloatingGroupedWithMeteredMinimum != null -> - visitor.visitNewFloatingGroupedWithMeteredMinimum( - newFloatingGroupedWithMeteredMinimum - ) - newFloatingMatrixWithDisplayName != null -> - visitor.visitNewFloatingMatrixWithDisplayName( - newFloatingMatrixWithDisplayName - ) - newFloatingBulkWithProration != null -> - visitor.visitNewFloatingBulkWithProration(newFloatingBulkWithProration) - newFloatingGroupedTieredPackage != null -> - visitor.visitNewFloatingGroupedTieredPackage( - newFloatingGroupedTieredPackage - ) - newFloatingScalableMatrixWithUnitPricing != null -> - visitor.visitNewFloatingScalableMatrixWithUnitPricing( - newFloatingScalableMatrixWithUnitPricing - ) - newFloatingScalableMatrixWithTieredPricing != null -> - visitor.visitNewFloatingScalableMatrixWithTieredPricing( - newFloatingScalableMatrixWithTieredPricing - ) - newFloatingCumulativeGroupedBulk != null -> - visitor.visitNewFloatingCumulativeGroupedBulk( - newFloatingCumulativeGroupedBulk + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + matrixWithAllocation != null -> + visitor.visitMatrixWithAllocation(matrixWithAllocation) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + groupedTiered != null -> visitor.visitGroupedTiered(groupedTiered) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredPackageWithMinimum != null -> + visitor.visitTieredPackageWithMinimum(tieredPackageWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + tieredWithProration != null -> + visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing ) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) else -> visitor.unknown(_json) } @@ -4286,171 +4021,142 @@ private constructor( accept( object : Visitor { - override fun visitNewFloatingUnit(newFloatingUnit: NewFloatingUnitPrice) { - newFloatingUnit.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewFloatingPackage( - newFloatingPackage: NewFloatingPackagePrice - ) { - newFloatingPackage.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewFloatingMatrix( - newFloatingMatrix: NewFloatingMatrixPrice - ) { - newFloatingMatrix.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewFloatingMatrixWithAllocation( - newFloatingMatrixWithAllocation: NewFloatingMatrixWithAllocationPrice + override fun visitMatrixWithAllocation( + matrixWithAllocation: MatrixWithAllocation ) { - newFloatingMatrixWithAllocation.validate() + matrixWithAllocation.validate() } - override fun visitNewFloatingTiered( - newFloatingTiered: NewFloatingTieredPrice - ) { - newFloatingTiered.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewFloatingTieredBps( - newFloatingTieredBps: NewFloatingTieredBpsPrice - ) { - newFloatingTieredBps.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewFloatingBps(newFloatingBps: NewFloatingBpsPrice) { - newFloatingBps.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewFloatingBulkBps( - newFloatingBulkBps: NewFloatingBulkBpsPrice - ) { - newFloatingBulkBps.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewFloatingBulk(newFloatingBulk: NewFloatingBulkPrice) { - newFloatingBulk.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewFloatingThresholdTotalAmount( - newFloatingThresholdTotalAmount: NewFloatingThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newFloatingThresholdTotalAmount.validate() + thresholdTotalAmount.validate() } - override fun visitNewFloatingTieredPackage( - newFloatingTieredPackage: NewFloatingTieredPackagePrice - ) { - newFloatingTieredPackage.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewFloatingGroupedTiered( - newFloatingGroupedTiered: NewFloatingGroupedTieredPrice - ) { - newFloatingGroupedTiered.validate() + override fun visitGroupedTiered(groupedTiered: GroupedTiered) { + groupedTiered.validate() } - override fun visitNewFloatingMaxGroupTieredPackage( - newFloatingMaxGroupTieredPackage: NewFloatingMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newFloatingMaxGroupTieredPackage.validate() + maxGroupTieredPackage.validate() } - override fun visitNewFloatingTieredWithMinimum( - newFloatingTieredWithMinimum: NewFloatingTieredWithMinimumPrice - ) { - newFloatingTieredWithMinimum.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewFloatingPackageWithAllocation( - newFloatingPackageWithAllocation: NewFloatingPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newFloatingPackageWithAllocation.validate() + packageWithAllocation.validate() } - override fun visitNewFloatingTieredPackageWithMinimum( - newFloatingTieredPackageWithMinimum: - NewFloatingTieredPackageWithMinimumPrice + override fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: TieredPackageWithMinimum ) { - newFloatingTieredPackageWithMinimum.validate() + tieredPackageWithMinimum.validate() } - override fun visitNewFloatingUnitWithPercent( - newFloatingUnitWithPercent: NewFloatingUnitWithPercentPrice - ) { - newFloatingUnitWithPercent.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewFloatingTieredWithProration( - newFloatingTieredWithProration: NewFloatingTieredWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newFloatingTieredWithProration.validate() + tieredWithProration.validate() } - override fun visitNewFloatingUnitWithProration( - newFloatingUnitWithProration: NewFloatingUnitWithProrationPrice - ) { - newFloatingUnitWithProration.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewFloatingGroupedAllocation( - newFloatingGroupedAllocation: NewFloatingGroupedAllocationPrice - ) { - newFloatingGroupedAllocation.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewFloatingGroupedWithProratedMinimum( - newFloatingGroupedWithProratedMinimum: - NewFloatingGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newFloatingGroupedWithProratedMinimum.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewFloatingGroupedWithMeteredMinimum( - newFloatingGroupedWithMeteredMinimum: - NewFloatingGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newFloatingGroupedWithMeteredMinimum.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewFloatingMatrixWithDisplayName( - newFloatingMatrixWithDisplayName: NewFloatingMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newFloatingMatrixWithDisplayName.validate() + matrixWithDisplayName.validate() } - override fun visitNewFloatingBulkWithProration( - newFloatingBulkWithProration: NewFloatingBulkWithProrationPrice - ) { - newFloatingBulkWithProration.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewFloatingGroupedTieredPackage( - newFloatingGroupedTieredPackage: NewFloatingGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newFloatingGroupedTieredPackage.validate() + groupedTieredPackage.validate() } - override fun visitNewFloatingScalableMatrixWithUnitPricing( - newFloatingScalableMatrixWithUnitPricing: - NewFloatingScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newFloatingScalableMatrixWithUnitPricing.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewFloatingScalableMatrixWithTieredPricing( - newFloatingScalableMatrixWithTieredPricing: - NewFloatingScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newFloatingScalableMatrixWithTieredPricing.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewFloatingCumulativeGroupedBulk( - newFloatingCumulativeGroupedBulk: NewFloatingCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newFloatingCumulativeGroupedBulk.validate() + cumulativeGroupedBulk.validate() } } ) @@ -4475,119 +4181,94 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewFloatingUnit(newFloatingUnit: NewFloatingUnitPrice) = - newFloatingUnit.validity() + override fun visitUnit(unit: Unit) = unit.validity() - override fun visitNewFloatingPackage( - newFloatingPackage: NewFloatingPackagePrice - ) = newFloatingPackage.validity() + override fun visitPackage(package_: Package) = package_.validity() - override fun visitNewFloatingMatrix( - newFloatingMatrix: NewFloatingMatrixPrice - ) = newFloatingMatrix.validity() + override fun visitMatrix(matrix: Matrix) = matrix.validity() - override fun visitNewFloatingMatrixWithAllocation( - newFloatingMatrixWithAllocation: NewFloatingMatrixWithAllocationPrice - ) = newFloatingMatrixWithAllocation.validity() + override fun visitMatrixWithAllocation( + matrixWithAllocation: MatrixWithAllocation + ) = matrixWithAllocation.validity() - override fun visitNewFloatingTiered( - newFloatingTiered: NewFloatingTieredPrice - ) = newFloatingTiered.validity() + override fun visitTiered(tiered: Tiered) = tiered.validity() - override fun visitNewFloatingTieredBps( - newFloatingTieredBps: NewFloatingTieredBpsPrice - ) = newFloatingTieredBps.validity() + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() - override fun visitNewFloatingBps(newFloatingBps: NewFloatingBpsPrice) = - newFloatingBps.validity() + override fun visitBps(bps: Bps) = bps.validity() - override fun visitNewFloatingBulkBps( - newFloatingBulkBps: NewFloatingBulkBpsPrice - ) = newFloatingBulkBps.validity() + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() - override fun visitNewFloatingBulk(newFloatingBulk: NewFloatingBulkPrice) = - newFloatingBulk.validity() + override fun visitBulk(bulk: Bulk) = bulk.validity() - override fun visitNewFloatingThresholdTotalAmount( - newFloatingThresholdTotalAmount: NewFloatingThresholdTotalAmountPrice - ) = newFloatingThresholdTotalAmount.validity() + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() - override fun visitNewFloatingTieredPackage( - newFloatingTieredPackage: NewFloatingTieredPackagePrice - ) = newFloatingTieredPackage.validity() + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() - override fun visitNewFloatingGroupedTiered( - newFloatingGroupedTiered: NewFloatingGroupedTieredPrice - ) = newFloatingGroupedTiered.validity() + override fun visitGroupedTiered(groupedTiered: GroupedTiered) = + groupedTiered.validity() - override fun visitNewFloatingMaxGroupTieredPackage( - newFloatingMaxGroupTieredPackage: NewFloatingMaxGroupTieredPackagePrice - ) = newFloatingMaxGroupTieredPackage.validity() + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() - override fun visitNewFloatingTieredWithMinimum( - newFloatingTieredWithMinimum: NewFloatingTieredWithMinimumPrice - ) = newFloatingTieredWithMinimum.validity() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() - override fun visitNewFloatingPackageWithAllocation( - newFloatingPackageWithAllocation: NewFloatingPackageWithAllocationPrice - ) = newFloatingPackageWithAllocation.validity() + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() - override fun visitNewFloatingTieredPackageWithMinimum( - newFloatingTieredPackageWithMinimum: - NewFloatingTieredPackageWithMinimumPrice - ) = newFloatingTieredPackageWithMinimum.validity() + override fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: TieredPackageWithMinimum + ) = tieredPackageWithMinimum.validity() - override fun visitNewFloatingUnitWithPercent( - newFloatingUnitWithPercent: NewFloatingUnitWithPercentPrice - ) = newFloatingUnitWithPercent.validity() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() - override fun visitNewFloatingTieredWithProration( - newFloatingTieredWithProration: NewFloatingTieredWithProrationPrice - ) = newFloatingTieredWithProration.validity() + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() - override fun visitNewFloatingUnitWithProration( - newFloatingUnitWithProration: NewFloatingUnitWithProrationPrice - ) = newFloatingUnitWithProration.validity() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() - override fun visitNewFloatingGroupedAllocation( - newFloatingGroupedAllocation: NewFloatingGroupedAllocationPrice - ) = newFloatingGroupedAllocation.validity() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() - override fun visitNewFloatingGroupedWithProratedMinimum( - newFloatingGroupedWithProratedMinimum: - NewFloatingGroupedWithProratedMinimumPrice - ) = newFloatingGroupedWithProratedMinimum.validity() + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() - override fun visitNewFloatingGroupedWithMeteredMinimum( - newFloatingGroupedWithMeteredMinimum: - NewFloatingGroupedWithMeteredMinimumPrice - ) = newFloatingGroupedWithMeteredMinimum.validity() + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() - override fun visitNewFloatingMatrixWithDisplayName( - newFloatingMatrixWithDisplayName: NewFloatingMatrixWithDisplayNamePrice - ) = newFloatingMatrixWithDisplayName.validity() + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() - override fun visitNewFloatingBulkWithProration( - newFloatingBulkWithProration: NewFloatingBulkWithProrationPrice - ) = newFloatingBulkWithProration.validity() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() - override fun visitNewFloatingGroupedTieredPackage( - newFloatingGroupedTieredPackage: NewFloatingGroupedTieredPackagePrice - ) = newFloatingGroupedTieredPackage.validity() + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() - override fun visitNewFloatingScalableMatrixWithUnitPricing( - newFloatingScalableMatrixWithUnitPricing: - NewFloatingScalableMatrixWithUnitPricingPrice - ) = newFloatingScalableMatrixWithUnitPricing.validity() + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() - override fun visitNewFloatingScalableMatrixWithTieredPricing( - newFloatingScalableMatrixWithTieredPricing: - NewFloatingScalableMatrixWithTieredPricingPrice - ) = newFloatingScalableMatrixWithTieredPricing.validity() + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() - override fun visitNewFloatingCumulativeGroupedBulk( - newFloatingCumulativeGroupedBulk: NewFloatingCumulativeGroupedBulkPrice - ) = newFloatingCumulativeGroupedBulk.validity() + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() override fun unknown(json: JsonValue?) = 0 } @@ -4598,217 +4279,158 @@ private constructor( return true } - return /* spotless:off */ other is Price && newFloatingUnit == other.newFloatingUnit && newFloatingPackage == other.newFloatingPackage && newFloatingMatrix == other.newFloatingMatrix && newFloatingMatrixWithAllocation == other.newFloatingMatrixWithAllocation && newFloatingTiered == other.newFloatingTiered && newFloatingTieredBps == other.newFloatingTieredBps && newFloatingBps == other.newFloatingBps && newFloatingBulkBps == other.newFloatingBulkBps && newFloatingBulk == other.newFloatingBulk && newFloatingThresholdTotalAmount == other.newFloatingThresholdTotalAmount && newFloatingTieredPackage == other.newFloatingTieredPackage && newFloatingGroupedTiered == other.newFloatingGroupedTiered && newFloatingMaxGroupTieredPackage == other.newFloatingMaxGroupTieredPackage && newFloatingTieredWithMinimum == other.newFloatingTieredWithMinimum && newFloatingPackageWithAllocation == other.newFloatingPackageWithAllocation && newFloatingTieredPackageWithMinimum == other.newFloatingTieredPackageWithMinimum && newFloatingUnitWithPercent == other.newFloatingUnitWithPercent && newFloatingTieredWithProration == other.newFloatingTieredWithProration && newFloatingUnitWithProration == other.newFloatingUnitWithProration && newFloatingGroupedAllocation == other.newFloatingGroupedAllocation && newFloatingGroupedWithProratedMinimum == other.newFloatingGroupedWithProratedMinimum && newFloatingGroupedWithMeteredMinimum == other.newFloatingGroupedWithMeteredMinimum && newFloatingMatrixWithDisplayName == other.newFloatingMatrixWithDisplayName && newFloatingBulkWithProration == other.newFloatingBulkWithProration && newFloatingGroupedTieredPackage == other.newFloatingGroupedTieredPackage && newFloatingScalableMatrixWithUnitPricing == other.newFloatingScalableMatrixWithUnitPricing && newFloatingScalableMatrixWithTieredPricing == other.newFloatingScalableMatrixWithTieredPricing && newFloatingCumulativeGroupedBulk == other.newFloatingCumulativeGroupedBulk /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && matrixWithAllocation == other.matrixWithAllocation && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && groupedTiered == other.groupedTiered && maxGroupTieredPackage == other.maxGroupTieredPackage && tieredWithMinimum == other.tieredWithMinimum && packageWithAllocation == other.packageWithAllocation && tieredPackageWithMinimum == other.tieredPackageWithMinimum && unitWithPercent == other.unitWithPercent && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnit, newFloatingPackage, newFloatingMatrix, newFloatingMatrixWithAllocation, newFloatingTiered, newFloatingTieredBps, newFloatingBps, newFloatingBulkBps, newFloatingBulk, newFloatingThresholdTotalAmount, newFloatingTieredPackage, newFloatingGroupedTiered, newFloatingMaxGroupTieredPackage, newFloatingTieredWithMinimum, newFloatingPackageWithAllocation, newFloatingTieredPackageWithMinimum, newFloatingUnitWithPercent, newFloatingTieredWithProration, newFloatingUnitWithProration, newFloatingGroupedAllocation, newFloatingGroupedWithProratedMinimum, newFloatingGroupedWithMeteredMinimum, newFloatingMatrixWithDisplayName, newFloatingBulkWithProration, newFloatingGroupedTieredPackage, newFloatingScalableMatrixWithUnitPricing, newFloatingScalableMatrixWithTieredPricing, newFloatingCumulativeGroupedBulk) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, matrixWithAllocation, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, groupedTiered, maxGroupTieredPackage, tieredWithMinimum, packageWithAllocation, tieredPackageWithMinimum, unitWithPercent, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk) /* spotless:on */ override fun toString(): String = when { - newFloatingUnit != null -> "Price{newFloatingUnit=$newFloatingUnit}" - newFloatingPackage != null -> "Price{newFloatingPackage=$newFloatingPackage}" - newFloatingMatrix != null -> "Price{newFloatingMatrix=$newFloatingMatrix}" - newFloatingMatrixWithAllocation != null -> - "Price{newFloatingMatrixWithAllocation=$newFloatingMatrixWithAllocation}" - newFloatingTiered != null -> "Price{newFloatingTiered=$newFloatingTiered}" - newFloatingTieredBps != null -> - "Price{newFloatingTieredBps=$newFloatingTieredBps}" - newFloatingBps != null -> "Price{newFloatingBps=$newFloatingBps}" - newFloatingBulkBps != null -> "Price{newFloatingBulkBps=$newFloatingBulkBps}" - newFloatingBulk != null -> "Price{newFloatingBulk=$newFloatingBulk}" - newFloatingThresholdTotalAmount != null -> - "Price{newFloatingThresholdTotalAmount=$newFloatingThresholdTotalAmount}" - newFloatingTieredPackage != null -> - "Price{newFloatingTieredPackage=$newFloatingTieredPackage}" - newFloatingGroupedTiered != null -> - "Price{newFloatingGroupedTiered=$newFloatingGroupedTiered}" - newFloatingMaxGroupTieredPackage != null -> - "Price{newFloatingMaxGroupTieredPackage=$newFloatingMaxGroupTieredPackage}" - newFloatingTieredWithMinimum != null -> - "Price{newFloatingTieredWithMinimum=$newFloatingTieredWithMinimum}" - newFloatingPackageWithAllocation != null -> - "Price{newFloatingPackageWithAllocation=$newFloatingPackageWithAllocation}" - newFloatingTieredPackageWithMinimum != null -> - "Price{newFloatingTieredPackageWithMinimum=$newFloatingTieredPackageWithMinimum}" - newFloatingUnitWithPercent != null -> - "Price{newFloatingUnitWithPercent=$newFloatingUnitWithPercent}" - newFloatingTieredWithProration != null -> - "Price{newFloatingTieredWithProration=$newFloatingTieredWithProration}" - newFloatingUnitWithProration != null -> - "Price{newFloatingUnitWithProration=$newFloatingUnitWithProration}" - newFloatingGroupedAllocation != null -> - "Price{newFloatingGroupedAllocation=$newFloatingGroupedAllocation}" - newFloatingGroupedWithProratedMinimum != null -> - "Price{newFloatingGroupedWithProratedMinimum=$newFloatingGroupedWithProratedMinimum}" - newFloatingGroupedWithMeteredMinimum != null -> - "Price{newFloatingGroupedWithMeteredMinimum=$newFloatingGroupedWithMeteredMinimum}" - newFloatingMatrixWithDisplayName != null -> - "Price{newFloatingMatrixWithDisplayName=$newFloatingMatrixWithDisplayName}" - newFloatingBulkWithProration != null -> - "Price{newFloatingBulkWithProration=$newFloatingBulkWithProration}" - newFloatingGroupedTieredPackage != null -> - "Price{newFloatingGroupedTieredPackage=$newFloatingGroupedTieredPackage}" - newFloatingScalableMatrixWithUnitPricing != null -> - "Price{newFloatingScalableMatrixWithUnitPricing=$newFloatingScalableMatrixWithUnitPricing}" - newFloatingScalableMatrixWithTieredPricing != null -> - "Price{newFloatingScalableMatrixWithTieredPricing=$newFloatingScalableMatrixWithTieredPricing}" - newFloatingCumulativeGroupedBulk != null -> - "Price{newFloatingCumulativeGroupedBulk=$newFloatingCumulativeGroupedBulk}" + unit != null -> "Price{unit=$unit}" + package_ != null -> "Price{package_=$package_}" + matrix != null -> "Price{matrix=$matrix}" + matrixWithAllocation != null -> + "Price{matrixWithAllocation=$matrixWithAllocation}" + tiered != null -> "Price{tiered=$tiered}" + tieredBps != null -> "Price{tieredBps=$tieredBps}" + bps != null -> "Price{bps=$bps}" + bulkBps != null -> "Price{bulkBps=$bulkBps}" + bulk != null -> "Price{bulk=$bulk}" + thresholdTotalAmount != null -> + "Price{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" + groupedTiered != null -> "Price{groupedTiered=$groupedTiered}" + maxGroupTieredPackage != null -> + "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" + tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" + packageWithAllocation != null -> + "Price{packageWithAllocation=$packageWithAllocation}" + tieredPackageWithMinimum != null -> + "Price{tieredPackageWithMinimum=$tieredPackageWithMinimum}" + unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" + tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + groupedWithMeteredMinimum != null -> + "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Price{matrixWithDisplayName=$matrixWithDisplayName}" + bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" + groupedTieredPackage != null -> + "Price{groupedTieredPackage=$groupedTieredPackage}" + scalableMatrixWithUnitPricing != null -> + "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } companion object { - @JvmStatic - fun ofNewFloatingUnit(newFloatingUnit: NewFloatingUnitPrice) = - Price(newFloatingUnit = newFloatingUnit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofNewFloatingPackage(newFloatingPackage: NewFloatingPackagePrice) = - Price(newFloatingPackage = newFloatingPackage) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic - fun ofNewFloatingMatrix(newFloatingMatrix: NewFloatingMatrixPrice) = - Price(newFloatingMatrix = newFloatingMatrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) @JvmStatic - fun ofNewFloatingMatrixWithAllocation( - newFloatingMatrixWithAllocation: NewFloatingMatrixWithAllocationPrice - ) = Price(newFloatingMatrixWithAllocation = newFloatingMatrixWithAllocation) + fun ofMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation) = + Price(matrixWithAllocation = matrixWithAllocation) - @JvmStatic - fun ofNewFloatingTiered(newFloatingTiered: NewFloatingTieredPrice) = - Price(newFloatingTiered = newFloatingTiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic - fun ofNewFloatingTieredBps(newFloatingTieredBps: NewFloatingTieredBpsPrice) = - Price(newFloatingTieredBps = newFloatingTieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic - fun ofNewFloatingBps(newFloatingBps: NewFloatingBpsPrice) = - Price(newFloatingBps = newFloatingBps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic - fun ofNewFloatingBulkBps(newFloatingBulkBps: NewFloatingBulkBpsPrice) = - Price(newFloatingBulkBps = newFloatingBulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic - fun ofNewFloatingBulk(newFloatingBulk: NewFloatingBulkPrice) = - Price(newFloatingBulk = newFloatingBulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofNewFloatingThresholdTotalAmount( - newFloatingThresholdTotalAmount: NewFloatingThresholdTotalAmountPrice - ) = Price(newFloatingThresholdTotalAmount = newFloatingThresholdTotalAmount) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewFloatingTieredPackage( - newFloatingTieredPackage: NewFloatingTieredPackagePrice - ) = Price(newFloatingTieredPackage = newFloatingTieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = + Price(tieredPackage = tieredPackage) @JvmStatic - fun ofNewFloatingGroupedTiered( - newFloatingGroupedTiered: NewFloatingGroupedTieredPrice - ) = Price(newFloatingGroupedTiered = newFloatingGroupedTiered) + fun ofGroupedTiered(groupedTiered: GroupedTiered) = + Price(groupedTiered = groupedTiered) @JvmStatic - fun ofNewFloatingMaxGroupTieredPackage( - newFloatingMaxGroupTieredPackage: NewFloatingMaxGroupTieredPackagePrice - ) = Price(newFloatingMaxGroupTieredPackage = newFloatingMaxGroupTieredPackage) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewFloatingTieredWithMinimum( - newFloatingTieredWithMinimum: NewFloatingTieredWithMinimumPrice - ) = Price(newFloatingTieredWithMinimum = newFloatingTieredWithMinimum) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewFloatingPackageWithAllocation( - newFloatingPackageWithAllocation: NewFloatingPackageWithAllocationPrice - ) = Price(newFloatingPackageWithAllocation = newFloatingPackageWithAllocation) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewFloatingTieredPackageWithMinimum( - newFloatingTieredPackageWithMinimum: NewFloatingTieredPackageWithMinimumPrice - ) = Price(newFloatingTieredPackageWithMinimum = newFloatingTieredPackageWithMinimum) + fun ofTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimum) = + Price(tieredPackageWithMinimum = tieredPackageWithMinimum) @JvmStatic - fun ofNewFloatingUnitWithPercent( - newFloatingUnitWithPercent: NewFloatingUnitWithPercentPrice - ) = Price(newFloatingUnitWithPercent = newFloatingUnitWithPercent) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewFloatingTieredWithProration( - newFloatingTieredWithProration: NewFloatingTieredWithProrationPrice - ) = Price(newFloatingTieredWithProration = newFloatingTieredWithProration) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewFloatingUnitWithProration( - newFloatingUnitWithProration: NewFloatingUnitWithProrationPrice - ) = Price(newFloatingUnitWithProration = newFloatingUnitWithProration) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Price(unitWithProration = unitWithProration) @JvmStatic - fun ofNewFloatingGroupedAllocation( - newFloatingGroupedAllocation: NewFloatingGroupedAllocationPrice - ) = Price(newFloatingGroupedAllocation = newFloatingGroupedAllocation) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewFloatingGroupedWithProratedMinimum( - newFloatingGroupedWithProratedMinimum: - NewFloatingGroupedWithProratedMinimumPrice - ) = - Price( - newFloatingGroupedWithProratedMinimum = - newFloatingGroupedWithProratedMinimum - ) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewFloatingGroupedWithMeteredMinimum( - newFloatingGroupedWithMeteredMinimum: NewFloatingGroupedWithMeteredMinimumPrice - ) = - Price( - newFloatingGroupedWithMeteredMinimum = newFloatingGroupedWithMeteredMinimum - ) + fun ofGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewFloatingMatrixWithDisplayName( - newFloatingMatrixWithDisplayName: NewFloatingMatrixWithDisplayNamePrice - ) = Price(newFloatingMatrixWithDisplayName = newFloatingMatrixWithDisplayName) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewFloatingBulkWithProration( - newFloatingBulkWithProration: NewFloatingBulkWithProrationPrice - ) = Price(newFloatingBulkWithProration = newFloatingBulkWithProration) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewFloatingGroupedTieredPackage( - newFloatingGroupedTieredPackage: NewFloatingGroupedTieredPackagePrice - ) = Price(newFloatingGroupedTieredPackage = newFloatingGroupedTieredPackage) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Price(groupedTieredPackage = groupedTieredPackage) @JvmStatic - fun ofNewFloatingScalableMatrixWithUnitPricing( - newFloatingScalableMatrixWithUnitPricing: - NewFloatingScalableMatrixWithUnitPricingPrice - ) = - Price( - newFloatingScalableMatrixWithUnitPricing = - newFloatingScalableMatrixWithUnitPricing - ) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewFloatingScalableMatrixWithTieredPricing( - newFloatingScalableMatrixWithTieredPricing: - NewFloatingScalableMatrixWithTieredPricingPrice - ) = - Price( - newFloatingScalableMatrixWithTieredPricing = - newFloatingScalableMatrixWithTieredPricing - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewFloatingCumulativeGroupedBulk( - newFloatingCumulativeGroupedBulk: NewFloatingCumulativeGroupedBulkPrice - ) = Price(newFloatingCumulativeGroupedBulk = newFloatingCumulativeGroupedBulk) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Price(cumulativeGroupedBulk = cumulativeGroupedBulk) } /** @@ -4816,104 +4438,71 @@ private constructor( */ interface Visitor { - fun visitNewFloatingUnit(newFloatingUnit: NewFloatingUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewFloatingPackage(newFloatingPackage: NewFloatingPackagePrice): T + fun visitPackage(package_: Package): T - fun visitNewFloatingMatrix(newFloatingMatrix: NewFloatingMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewFloatingMatrixWithAllocation( - newFloatingMatrixWithAllocation: NewFloatingMatrixWithAllocationPrice - ): T + fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation): T - fun visitNewFloatingTiered(newFloatingTiered: NewFloatingTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewFloatingTieredBps(newFloatingTieredBps: NewFloatingTieredBpsPrice): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewFloatingBps(newFloatingBps: NewFloatingBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewFloatingBulkBps(newFloatingBulkBps: NewFloatingBulkBpsPrice): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewFloatingBulk(newFloatingBulk: NewFloatingBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewFloatingThresholdTotalAmount( - newFloatingThresholdTotalAmount: NewFloatingThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewFloatingTieredPackage( - newFloatingTieredPackage: NewFloatingTieredPackagePrice - ): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewFloatingGroupedTiered( - newFloatingGroupedTiered: NewFloatingGroupedTieredPrice - ): T + fun visitGroupedTiered(groupedTiered: GroupedTiered): T - fun visitNewFloatingMaxGroupTieredPackage( - newFloatingMaxGroupTieredPackage: NewFloatingMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewFloatingTieredWithMinimum( - newFloatingTieredWithMinimum: NewFloatingTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewFloatingPackageWithAllocation( - newFloatingPackageWithAllocation: NewFloatingPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewFloatingTieredPackageWithMinimum( - newFloatingTieredPackageWithMinimum: NewFloatingTieredPackageWithMinimumPrice + fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: TieredPackageWithMinimum ): T - fun visitNewFloatingUnitWithPercent( - newFloatingUnitWithPercent: NewFloatingUnitWithPercentPrice - ): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewFloatingTieredWithProration( - newFloatingTieredWithProration: NewFloatingTieredWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewFloatingUnitWithProration( - newFloatingUnitWithProration: NewFloatingUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewFloatingGroupedAllocation( - newFloatingGroupedAllocation: NewFloatingGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewFloatingGroupedWithProratedMinimum( - newFloatingGroupedWithProratedMinimum: - NewFloatingGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewFloatingGroupedWithMeteredMinimum( - newFloatingGroupedWithMeteredMinimum: NewFloatingGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewFloatingMatrixWithDisplayName( - newFloatingMatrixWithDisplayName: NewFloatingMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewFloatingBulkWithProration( - newFloatingBulkWithProration: NewFloatingBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewFloatingGroupedTieredPackage( - newFloatingGroupedTieredPackage: NewFloatingGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T - fun visitNewFloatingScalableMatrixWithUnitPricing( - newFloatingScalableMatrixWithUnitPricing: - NewFloatingScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewFloatingScalableMatrixWithTieredPricing( - newFloatingScalableMatrixWithTieredPricing: - NewFloatingScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewFloatingCumulativeGroupedBulk( - newFloatingCumulativeGroupedBulk: NewFloatingCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -4939,216 +4528,152 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingUnit = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unit = it, _json = json) + } ?: Price(_json = json) } "package" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) + } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingMatrix = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrix = it, _json = json) + } ?: Price(_json = json) } "matrix_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingMatrixWithAllocation = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(matrixWithAllocation = it, _json = json) } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingTiered = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tiered = it, _json = json) + } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingTieredBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredBps = it, _json = json) + } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bps = it, _json = json) + } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingBulkBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkBps = it, _json = json) + } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newFloatingBulk = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulk = it, _json = json) + } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingThresholdTotalAmount = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(thresholdTotalAmount = it, _json = json) } ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackage = it, _json = json) + } ?: Price(_json = json) } "grouped_tiered" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingGroupedTiered = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedTiered = it, _json = json) + } ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingMaxGroupTieredPackage = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(maxGroupTieredPackage = it, _json = json) } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingTieredWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithMinimum = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingPackageWithAllocation = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(packageWithAllocation = it, _json = json) } ?: Price(_json = json) } "tiered_package_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newFloatingTieredPackageWithMinimum = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(tieredPackageWithMinimum = it, _json = json) } + ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingUnitWithPercent = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithPercent = it, _json = json) + } ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingTieredWithProration = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(tieredWithProration = it, _json = json) } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingUnitWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingGroupedAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedAllocation = it, _json = json) + } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price(newFloatingGroupedWithProratedMinimum = it, _json = json) - } ?: Price(_json = json) + ?.let { Price(groupedWithProratedMinimum = it, _json = json) } + ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newFloatingGroupedWithMeteredMinimum = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } + ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingMatrixWithDisplayName = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(matrixWithDisplayName = it, _json = json) } ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingBulkWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingGroupedTieredPackage = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedTieredPackage = it, _json = json) } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price( - newFloatingScalableMatrixWithUnitPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } + ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewFloatingScalableMatrixWithTieredPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newFloatingScalableMatrixWithTieredPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newFloatingCumulativeGroupedBulk = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(cumulativeGroupedBulk = it, _json = json) } ?: Price(_json = json) } } @@ -5165,68 +4690,59 @@ private constructor( provider: SerializerProvider, ) { when { - value.newFloatingUnit != null -> - generator.writeObject(value.newFloatingUnit) - value.newFloatingPackage != null -> - generator.writeObject(value.newFloatingPackage) - value.newFloatingMatrix != null -> - generator.writeObject(value.newFloatingMatrix) - value.newFloatingMatrixWithAllocation != null -> - generator.writeObject(value.newFloatingMatrixWithAllocation) - value.newFloatingTiered != null -> - generator.writeObject(value.newFloatingTiered) - value.newFloatingTieredBps != null -> - generator.writeObject(value.newFloatingTieredBps) - value.newFloatingBps != null -> generator.writeObject(value.newFloatingBps) - value.newFloatingBulkBps != null -> - generator.writeObject(value.newFloatingBulkBps) - value.newFloatingBulk != null -> - generator.writeObject(value.newFloatingBulk) - value.newFloatingThresholdTotalAmount != null -> - generator.writeObject(value.newFloatingThresholdTotalAmount) - value.newFloatingTieredPackage != null -> - generator.writeObject(value.newFloatingTieredPackage) - value.newFloatingGroupedTiered != null -> - generator.writeObject(value.newFloatingGroupedTiered) - value.newFloatingMaxGroupTieredPackage != null -> - generator.writeObject(value.newFloatingMaxGroupTieredPackage) - value.newFloatingTieredWithMinimum != null -> - generator.writeObject(value.newFloatingTieredWithMinimum) - value.newFloatingPackageWithAllocation != null -> - generator.writeObject(value.newFloatingPackageWithAllocation) - value.newFloatingTieredPackageWithMinimum != null -> - generator.writeObject(value.newFloatingTieredPackageWithMinimum) - value.newFloatingUnitWithPercent != null -> - generator.writeObject(value.newFloatingUnitWithPercent) - value.newFloatingTieredWithProration != null -> - generator.writeObject(value.newFloatingTieredWithProration) - value.newFloatingUnitWithProration != null -> - generator.writeObject(value.newFloatingUnitWithProration) - value.newFloatingGroupedAllocation != null -> - generator.writeObject(value.newFloatingGroupedAllocation) - value.newFloatingGroupedWithProratedMinimum != null -> - generator.writeObject(value.newFloatingGroupedWithProratedMinimum) - value.newFloatingGroupedWithMeteredMinimum != null -> - generator.writeObject(value.newFloatingGroupedWithMeteredMinimum) - value.newFloatingMatrixWithDisplayName != null -> - generator.writeObject(value.newFloatingMatrixWithDisplayName) - value.newFloatingBulkWithProration != null -> - generator.writeObject(value.newFloatingBulkWithProration) - value.newFloatingGroupedTieredPackage != null -> - generator.writeObject(value.newFloatingGroupedTieredPackage) - value.newFloatingScalableMatrixWithUnitPricing != null -> - generator.writeObject(value.newFloatingScalableMatrixWithUnitPricing) - value.newFloatingScalableMatrixWithTieredPricing != null -> - generator.writeObject(value.newFloatingScalableMatrixWithTieredPricing) - value.newFloatingCumulativeGroupedBulk != null -> - generator.writeObject(value.newFloatingCumulativeGroupedBulk) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.matrixWithAllocation != null -> + generator.writeObject(value.matrixWithAllocation) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.groupedTiered != null -> generator.writeObject(value.groupedTiered) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredPackageWithMinimum != null -> + generator.writeObject(value.tieredPackageWithMinimum) + value.unitWithPercent != null -> + generator.writeObject(value.unitWithPercent) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } } } - class NewFloatingUnitPrice + class Unit private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -5608,8 +5124,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -5623,7 +5138,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -5647,25 +5162,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { - cadence = newFloatingUnitPrice.cadence - currency = newFloatingUnitPrice.currency - itemId = newFloatingUnitPrice.itemId - modelType = newFloatingUnitPrice.modelType - name = newFloatingUnitPrice.name - unitConfig = newFloatingUnitPrice.unitConfig - billableMetricId = newFloatingUnitPrice.billableMetricId - billedInAdvance = newFloatingUnitPrice.billedInAdvance - billingCycleConfiguration = newFloatingUnitPrice.billingCycleConfiguration - conversionRate = newFloatingUnitPrice.conversionRate - externalPriceId = newFloatingUnitPrice.externalPriceId - fixedPriceQuantity = newFloatingUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingUnitPrice.invoicingCycleConfiguration - metadata = newFloatingUnitPrice.metadata - additionalProperties = - newFloatingUnitPrice.additionalProperties.toMutableMap() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + currency = unit.currency + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -6010,7 +5523,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6025,8 +5538,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingUnitPrice = - NewFloatingUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -6048,7 +5561,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -7275,7 +6788,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -7285,10 +6798,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewFloatingPackagePrice + class Package private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -7670,8 +7183,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -7685,7 +7197,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -7709,26 +7221,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { - cadence = newFloatingPackagePrice.cadence - currency = newFloatingPackagePrice.currency - itemId = newFloatingPackagePrice.itemId - modelType = newFloatingPackagePrice.modelType - name = newFloatingPackagePrice.name - packageConfig = newFloatingPackagePrice.packageConfig - billableMetricId = newFloatingPackagePrice.billableMetricId - billedInAdvance = newFloatingPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingPackagePrice.billingCycleConfiguration - conversionRate = newFloatingPackagePrice.conversionRate - externalPriceId = newFloatingPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingPackagePrice.invoicingCycleConfiguration - metadata = newFloatingPackagePrice.metadata - additionalProperties = - newFloatingPackagePrice.additionalProperties.toMutableMap() + internal fun from(package_: Package) = apply { + cadence = package_.cadence + currency = package_.currency + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + additionalProperties = package_.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -8074,7 +7583,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -8089,8 +7598,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingPackagePrice = - NewFloatingPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -8112,7 +7621,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -9390,7 +8899,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -9400,10 +8909,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewFloatingMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -9785,8 +9294,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -9800,7 +9308,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -9824,25 +9332,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { - cadence = newFloatingMatrixPrice.cadence - currency = newFloatingMatrixPrice.currency - itemId = newFloatingMatrixPrice.itemId - matrixConfig = newFloatingMatrixPrice.matrixConfig - modelType = newFloatingMatrixPrice.modelType - name = newFloatingMatrixPrice.name - billableMetricId = newFloatingMatrixPrice.billableMetricId - billedInAdvance = newFloatingMatrixPrice.billedInAdvance - billingCycleConfiguration = newFloatingMatrixPrice.billingCycleConfiguration - conversionRate = newFloatingMatrixPrice.conversionRate - externalPriceId = newFloatingMatrixPrice.externalPriceId - fixedPriceQuantity = newFloatingMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingMatrixPrice.invoicingCycleConfiguration - metadata = newFloatingMatrixPrice.metadata - additionalProperties = - newFloatingMatrixPrice.additionalProperties.toMutableMap() + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + currency = matrix.currency + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + additionalProperties = matrix.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -10188,7 +9694,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -10203,8 +9709,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMatrixPrice = - NewFloatingMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -10226,7 +9732,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -11827,7 +11333,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -11837,10 +11343,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewFloatingMatrixWithAllocationPrice + class MatrixWithAllocation private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -12226,7 +11732,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingMatrixWithAllocationPrice]. + * [MatrixWithAllocation]. * * The following fields are required: * ```java @@ -12240,7 +11746,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMatrixWithAllocationPrice]. */ + /** A builder for [MatrixWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -12265,29 +11771,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ) = apply { - cadence = newFloatingMatrixWithAllocationPrice.cadence - currency = newFloatingMatrixWithAllocationPrice.currency - itemId = newFloatingMatrixWithAllocationPrice.itemId - matrixWithAllocationConfig = - newFloatingMatrixWithAllocationPrice.matrixWithAllocationConfig - modelType = newFloatingMatrixWithAllocationPrice.modelType - name = newFloatingMatrixWithAllocationPrice.name - billableMetricId = newFloatingMatrixWithAllocationPrice.billableMetricId - billedInAdvance = newFloatingMatrixWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingMatrixWithAllocationPrice.billingCycleConfiguration - conversionRate = newFloatingMatrixWithAllocationPrice.conversionRate - externalPriceId = newFloatingMatrixWithAllocationPrice.externalPriceId - fixedPriceQuantity = newFloatingMatrixWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixWithAllocationPrice.invoiceGroupingKey + internal fun from(matrixWithAllocation: MatrixWithAllocation) = apply { + cadence = matrixWithAllocation.cadence + currency = matrixWithAllocation.currency + itemId = matrixWithAllocation.itemId + matrixWithAllocationConfig = matrixWithAllocation.matrixWithAllocationConfig + modelType = matrixWithAllocation.modelType + name = matrixWithAllocation.name + billableMetricId = matrixWithAllocation.billableMetricId + billedInAdvance = matrixWithAllocation.billedInAdvance + billingCycleConfiguration = matrixWithAllocation.billingCycleConfiguration + conversionRate = matrixWithAllocation.conversionRate + externalPriceId = matrixWithAllocation.externalPriceId + fixedPriceQuantity = matrixWithAllocation.fixedPriceQuantity + invoiceGroupingKey = matrixWithAllocation.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingMatrixWithAllocationPrice.invoicingCycleConfiguration - metadata = newFloatingMatrixWithAllocationPrice.metadata + matrixWithAllocation.invoicingCycleConfiguration + metadata = matrixWithAllocation.metadata additionalProperties = - newFloatingMatrixWithAllocationPrice.additionalProperties.toMutableMap() + matrixWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -12635,7 +12137,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMatrixWithAllocationPrice]. + * Returns an immutable instance of [MatrixWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -12650,8 +12152,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMatrixWithAllocationPrice = - NewFloatingMatrixWithAllocationPrice( + fun build(): MatrixWithAllocation = + MatrixWithAllocation( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -12673,7 +12175,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMatrixWithAllocationPrice = apply { + fun validate(): MatrixWithAllocation = apply { if (validated) { return@apply } @@ -14333,7 +13835,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is MatrixWithAllocation && 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 */ @@ -14343,10 +13845,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "MatrixWithAllocation{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}" } - class NewFloatingTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -14728,8 +14230,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -14743,7 +14244,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -14767,25 +14268,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { - cadence = newFloatingTieredPrice.cadence - currency = newFloatingTieredPrice.currency - itemId = newFloatingTieredPrice.itemId - modelType = newFloatingTieredPrice.modelType - name = newFloatingTieredPrice.name - tieredConfig = newFloatingTieredPrice.tieredConfig - billableMetricId = newFloatingTieredPrice.billableMetricId - billedInAdvance = newFloatingTieredPrice.billedInAdvance - billingCycleConfiguration = newFloatingTieredPrice.billingCycleConfiguration - conversionRate = newFloatingTieredPrice.conversionRate - externalPriceId = newFloatingTieredPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredPrice.invoicingCycleConfiguration - metadata = newFloatingTieredPrice.metadata - additionalProperties = - newFloatingTieredPrice.additionalProperties.toMutableMap() + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + currency = tiered.currency + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + additionalProperties = tiered.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -15131,7 +14630,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -15146,8 +14645,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredPrice = - NewFloatingTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -15169,7 +14668,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -16688,7 +16187,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -16698,10 +16197,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewFloatingTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -17084,8 +16583,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -17099,7 +16597,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -17123,28 +16621,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = - apply { - cadence = newFloatingTieredBpsPrice.cadence - currency = newFloatingTieredBpsPrice.currency - itemId = newFloatingTieredBpsPrice.itemId - modelType = newFloatingTieredBpsPrice.modelType - name = newFloatingTieredBpsPrice.name - tieredBpsConfig = newFloatingTieredBpsPrice.tieredBpsConfig - billableMetricId = newFloatingTieredBpsPrice.billableMetricId - billedInAdvance = newFloatingTieredBpsPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredBpsPrice.billingCycleConfiguration - conversionRate = newFloatingTieredBpsPrice.conversionRate - externalPriceId = newFloatingTieredBpsPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredBpsPrice.invoicingCycleConfiguration - metadata = newFloatingTieredBpsPrice.metadata - additionalProperties = - newFloatingTieredBpsPrice.additionalProperties.toMutableMap() - } + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + currency = tieredBps.currency + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + additionalProperties = tieredBps.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -17489,7 +16983,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -17504,8 +16998,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredBpsPrice = - NewFloatingTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -17527,7 +17021,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -19088,7 +18582,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -19098,10 +18592,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewFloatingBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -19483,8 +18977,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -19498,7 +18991,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -19522,25 +19015,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { - bpsConfig = newFloatingBpsPrice.bpsConfig - cadence = newFloatingBpsPrice.cadence - currency = newFloatingBpsPrice.currency - itemId = newFloatingBpsPrice.itemId - modelType = newFloatingBpsPrice.modelType - name = newFloatingBpsPrice.name - billableMetricId = newFloatingBpsPrice.billableMetricId - billedInAdvance = newFloatingBpsPrice.billedInAdvance - billingCycleConfiguration = newFloatingBpsPrice.billingCycleConfiguration - conversionRate = newFloatingBpsPrice.conversionRate - externalPriceId = newFloatingBpsPrice.externalPriceId - fixedPriceQuantity = newFloatingBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingBpsPrice.invoicingCycleConfiguration - metadata = newFloatingBpsPrice.metadata - additionalProperties = - newFloatingBpsPrice.additionalProperties.toMutableMap() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + currency = bps.currency + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -19885,7 +19376,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -19900,8 +19391,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBpsPrice = - NewFloatingBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -19923,7 +19414,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -21197,7 +20688,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -21207,10 +20698,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewFloatingBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -21592,8 +21083,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -21607,7 +21097,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -21631,26 +21121,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { - bulkBpsConfig = newFloatingBulkBpsPrice.bulkBpsConfig - cadence = newFloatingBulkBpsPrice.cadence - currency = newFloatingBulkBpsPrice.currency - itemId = newFloatingBulkBpsPrice.itemId - modelType = newFloatingBulkBpsPrice.modelType - name = newFloatingBulkBpsPrice.name - billableMetricId = newFloatingBulkBpsPrice.billableMetricId - billedInAdvance = newFloatingBulkBpsPrice.billedInAdvance - billingCycleConfiguration = - newFloatingBulkBpsPrice.billingCycleConfiguration - conversionRate = newFloatingBulkBpsPrice.conversionRate - externalPriceId = newFloatingBulkBpsPrice.externalPriceId - fixedPriceQuantity = newFloatingBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkBpsPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingBulkBpsPrice.invoicingCycleConfiguration - metadata = newFloatingBulkBpsPrice.metadata - additionalProperties = - newFloatingBulkBpsPrice.additionalProperties.toMutableMap() + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + currency = bulkBps.currency + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + additionalProperties = bulkBps.additionalProperties.toMutableMap() } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = @@ -21996,7 +21483,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -22011,8 +21498,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBulkBpsPrice = - NewFloatingBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -22034,7 +21521,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -23549,7 +23036,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -23559,10 +23046,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewFloatingBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -23944,8 +23431,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -23959,7 +23445,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -23983,25 +23469,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { - bulkConfig = newFloatingBulkPrice.bulkConfig - cadence = newFloatingBulkPrice.cadence - currency = newFloatingBulkPrice.currency - itemId = newFloatingBulkPrice.itemId - modelType = newFloatingBulkPrice.modelType - name = newFloatingBulkPrice.name - billableMetricId = newFloatingBulkPrice.billableMetricId - billedInAdvance = newFloatingBulkPrice.billedInAdvance - billingCycleConfiguration = newFloatingBulkPrice.billingCycleConfiguration - conversionRate = newFloatingBulkPrice.conversionRate - externalPriceId = newFloatingBulkPrice.externalPriceId - fixedPriceQuantity = newFloatingBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingBulkPrice.invoicingCycleConfiguration - metadata = newFloatingBulkPrice.metadata - additionalProperties = - newFloatingBulkPrice.additionalProperties.toMutableMap() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + currency = bulk.currency + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -24346,7 +23830,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -24361,8 +23845,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBulkPrice = - NewFloatingBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -24384,7 +23868,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -25857,7 +25341,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -25867,10 +25351,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewFloatingThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -26256,7 +25740,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingThresholdTotalAmountPrice]. + * [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -26270,7 +25754,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -26295,29 +25779,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ) = apply { - cadence = newFloatingThresholdTotalAmountPrice.cadence - currency = newFloatingThresholdTotalAmountPrice.currency - itemId = newFloatingThresholdTotalAmountPrice.itemId - modelType = newFloatingThresholdTotalAmountPrice.modelType - name = newFloatingThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newFloatingThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newFloatingThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newFloatingThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newFloatingThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newFloatingThresholdTotalAmountPrice.conversionRate - externalPriceId = newFloatingThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = newFloatingThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingThresholdTotalAmountPrice.invoiceGroupingKey + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + currency = thresholdTotalAmount.currency + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newFloatingThresholdTotalAmountPrice.metadata + thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata additionalProperties = - newFloatingThresholdTotalAmountPrice.additionalProperties.toMutableMap() + thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -26665,7 +26145,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -26680,8 +26160,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingThresholdTotalAmountPrice = - NewFloatingThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -26703,7 +26183,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -27875,7 +27355,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -27885,10 +27365,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewFloatingTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -28271,8 +27751,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -28286,7 +27765,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -28310,28 +27789,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ) = apply { - cadence = newFloatingTieredPackagePrice.cadence - currency = newFloatingTieredPackagePrice.currency - itemId = newFloatingTieredPackagePrice.itemId - modelType = newFloatingTieredPackagePrice.modelType - name = newFloatingTieredPackagePrice.name - tieredPackageConfig = newFloatingTieredPackagePrice.tieredPackageConfig - billableMetricId = newFloatingTieredPackagePrice.billableMetricId - billedInAdvance = newFloatingTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredPackagePrice.billingCycleConfiguration - conversionRate = newFloatingTieredPackagePrice.conversionRate - externalPriceId = newFloatingTieredPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackagePrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredPackagePrice.invoicingCycleConfiguration - metadata = newFloatingTieredPackagePrice.metadata - additionalProperties = - newFloatingTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + currency = tieredPackage.currency + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -28678,7 +28152,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -28693,8 +28167,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredPackagePrice = - NewFloatingTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -28716,7 +28190,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -29885,7 +29359,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -29895,10 +29369,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewFloatingGroupedTieredPrice + class GroupedTiered private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -30281,8 +29755,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedTieredPrice]. + * Returns a mutable builder for constructing an instance of [GroupedTiered]. * * The following fields are required: * ```java @@ -30296,7 +29769,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedTieredPrice]. */ + /** A builder for [GroupedTiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -30320,28 +29793,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ) = apply { - cadence = newFloatingGroupedTieredPrice.cadence - currency = newFloatingGroupedTieredPrice.currency - groupedTieredConfig = newFloatingGroupedTieredPrice.groupedTieredConfig - itemId = newFloatingGroupedTieredPrice.itemId - modelType = newFloatingGroupedTieredPrice.modelType - name = newFloatingGroupedTieredPrice.name - billableMetricId = newFloatingGroupedTieredPrice.billableMetricId - billedInAdvance = newFloatingGroupedTieredPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedTieredPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedTieredPrice.conversionRate - externalPriceId = newFloatingGroupedTieredPrice.externalPriceId - fixedPriceQuantity = newFloatingGroupedTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedTieredPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedTieredPrice.metadata - additionalProperties = - newFloatingGroupedTieredPrice.additionalProperties.toMutableMap() + internal fun from(groupedTiered: GroupedTiered) = apply { + cadence = groupedTiered.cadence + currency = groupedTiered.currency + groupedTieredConfig = groupedTiered.groupedTieredConfig + itemId = groupedTiered.itemId + modelType = groupedTiered.modelType + name = groupedTiered.name + billableMetricId = groupedTiered.billableMetricId + billedInAdvance = groupedTiered.billedInAdvance + billingCycleConfiguration = groupedTiered.billingCycleConfiguration + conversionRate = groupedTiered.conversionRate + externalPriceId = groupedTiered.externalPriceId + fixedPriceQuantity = groupedTiered.fixedPriceQuantity + invoiceGroupingKey = groupedTiered.invoiceGroupingKey + invoicingCycleConfiguration = groupedTiered.invoicingCycleConfiguration + metadata = groupedTiered.metadata + additionalProperties = groupedTiered.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -30688,7 +30156,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedTieredPrice]. + * Returns an immutable instance of [GroupedTiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -30703,8 +30171,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedTieredPrice = - NewFloatingGroupedTieredPrice( + fun build(): GroupedTiered = + GroupedTiered( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("groupedTieredConfig", groupedTieredConfig), @@ -30726,7 +30194,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedTieredPrice = apply { + fun validate(): GroupedTiered = apply { if (validated) { return@apply } @@ -31895,7 +31363,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedTiered && 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 */ @@ -31905,10 +31373,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedTiered{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}" } - class NewFloatingMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -32294,7 +31762,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -32308,7 +31776,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -32334,32 +31802,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ) = apply { - cadence = newFloatingMaxGroupTieredPackagePrice.cadence - currency = newFloatingMaxGroupTieredPackagePrice.currency - itemId = newFloatingMaxGroupTieredPackagePrice.itemId + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + currency = maxGroupTieredPackage.currency + itemId = maxGroupTieredPackage.itemId maxGroupTieredPackageConfig = - newFloatingMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newFloatingMaxGroupTieredPackagePrice.modelType - name = newFloatingMaxGroupTieredPackagePrice.name - billableMetricId = newFloatingMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newFloatingMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newFloatingMaxGroupTieredPackagePrice.conversionRate - externalPriceId = newFloatingMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newFloatingMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingMaxGroupTieredPackagePrice.invoiceGroupingKey + maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newFloatingMaxGroupTieredPackagePrice.metadata + maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata additionalProperties = - newFloatingMaxGroupTieredPackagePrice.additionalProperties - .toMutableMap() + maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -32707,7 +32169,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -32722,8 +32184,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMaxGroupTieredPackagePrice = - NewFloatingMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -32748,7 +32210,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -33921,7 +33383,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingMaxGroupTieredPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && currency == other.currency && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -33931,10 +33393,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMaxGroupTieredPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "MaxGroupTieredPackage{cadence=$cadence, currency=$currency, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewFloatingTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -34319,7 +33781,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredWithMinimumPrice]. + * [TieredWithMinimum]. * * The following fields are required: * ```java @@ -34333,7 +33795,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -34357,29 +33819,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) = apply { - cadence = newFloatingTieredWithMinimumPrice.cadence - currency = newFloatingTieredWithMinimumPrice.currency - itemId = newFloatingTieredWithMinimumPrice.itemId - modelType = newFloatingTieredWithMinimumPrice.modelType - name = newFloatingTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newFloatingTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newFloatingTieredWithMinimumPrice.billableMetricId - billedInAdvance = newFloatingTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingTieredWithMinimumPrice.conversionRate - externalPriceId = newFloatingTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingTieredWithMinimumPrice.metadata - additionalProperties = - newFloatingTieredWithMinimumPrice.additionalProperties.toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + currency = tieredWithMinimum.currency + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -34725,7 +34181,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -34740,8 +34196,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredWithMinimumPrice = - NewFloatingTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -34763,7 +34219,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -35935,7 +35391,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -35945,10 +35401,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewFloatingPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -36334,7 +35790,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -36348,7 +35804,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -36374,32 +35830,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ) = apply { - cadence = newFloatingPackageWithAllocationPrice.cadence - currency = newFloatingPackageWithAllocationPrice.currency - itemId = newFloatingPackageWithAllocationPrice.itemId - modelType = newFloatingPackageWithAllocationPrice.modelType - name = newFloatingPackageWithAllocationPrice.name + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + currency = packageWithAllocation.currency + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name packageWithAllocationConfig = - newFloatingPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = newFloatingPackageWithAllocationPrice.billableMetricId - billedInAdvance = newFloatingPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newFloatingPackageWithAllocationPrice.conversionRate - externalPriceId = newFloatingPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = - newFloatingPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingPackageWithAllocationPrice.invoiceGroupingKey + packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newFloatingPackageWithAllocationPrice.metadata + packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata additionalProperties = - newFloatingPackageWithAllocationPrice.additionalProperties - .toMutableMap() + packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -36747,7 +36197,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -36762,8 +36212,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingPackageWithAllocationPrice = - NewFloatingPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -36788,7 +36238,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -37961,7 +37411,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -37971,10 +37421,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewFloatingTieredPackageWithMinimumPrice + class TieredPackageWithMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -38361,7 +37811,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredPackageWithMinimumPrice]. + * [TieredPackageWithMinimum]. * * The following fields are required: * ```java @@ -38375,7 +37825,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredPackageWithMinimumPrice]. */ + /** A builder for [TieredPackageWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -38401,33 +37851,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredPackageWithMinimumPrice: - NewFloatingTieredPackageWithMinimumPrice - ) = apply { - cadence = newFloatingTieredPackageWithMinimumPrice.cadence - currency = newFloatingTieredPackageWithMinimumPrice.currency - itemId = newFloatingTieredPackageWithMinimumPrice.itemId - modelType = newFloatingTieredPackageWithMinimumPrice.modelType - name = newFloatingTieredPackageWithMinimumPrice.name + internal fun from(tieredPackageWithMinimum: TieredPackageWithMinimum) = apply { + cadence = tieredPackageWithMinimum.cadence + currency = tieredPackageWithMinimum.currency + itemId = tieredPackageWithMinimum.itemId + modelType = tieredPackageWithMinimum.modelType + name = tieredPackageWithMinimum.name tieredPackageWithMinimumConfig = - newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig - billableMetricId = newFloatingTieredPackageWithMinimumPrice.billableMetricId - billedInAdvance = newFloatingTieredPackageWithMinimumPrice.billedInAdvance + tieredPackageWithMinimum.tieredPackageWithMinimumConfig + billableMetricId = tieredPackageWithMinimum.billableMetricId + billedInAdvance = tieredPackageWithMinimum.billedInAdvance billingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate - externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId - fixedPriceQuantity = - newFloatingTieredPackageWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingTieredPackageWithMinimumPrice.invoiceGroupingKey + tieredPackageWithMinimum.billingCycleConfiguration + conversionRate = tieredPackageWithMinimum.conversionRate + externalPriceId = tieredPackageWithMinimum.externalPriceId + fixedPriceQuantity = tieredPackageWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredPackageWithMinimum.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingTieredPackageWithMinimumPrice.metadata + tieredPackageWithMinimum.invoicingCycleConfiguration + metadata = tieredPackageWithMinimum.metadata additionalProperties = - newFloatingTieredPackageWithMinimumPrice.additionalProperties - .toMutableMap() + tieredPackageWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -38777,7 +38221,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredPackageWithMinimumPrice]. + * Returns an immutable instance of [TieredPackageWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -38792,8 +38236,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredPackageWithMinimumPrice = - NewFloatingTieredPackageWithMinimumPrice( + fun build(): TieredPackageWithMinimum = + TieredPackageWithMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -38818,7 +38262,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredPackageWithMinimumPrice = apply { + fun validate(): TieredPackageWithMinimum = apply { if (validated) { return@apply } @@ -39991,7 +39435,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackageWithMinimum && 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 */ @@ -40001,10 +39445,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackageWithMinimum{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}" } - class NewFloatingUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -40388,8 +39832,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewFloatingUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -40403,7 +39846,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -40427,29 +39870,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) = apply { - cadence = newFloatingUnitWithPercentPrice.cadence - currency = newFloatingUnitWithPercentPrice.currency - itemId = newFloatingUnitWithPercentPrice.itemId - modelType = newFloatingUnitWithPercentPrice.modelType - name = newFloatingUnitWithPercentPrice.name - unitWithPercentConfig = - newFloatingUnitWithPercentPrice.unitWithPercentConfig - billableMetricId = newFloatingUnitWithPercentPrice.billableMetricId - billedInAdvance = newFloatingUnitWithPercentPrice.billedInAdvance - billingCycleConfiguration = - newFloatingUnitWithPercentPrice.billingCycleConfiguration - conversionRate = newFloatingUnitWithPercentPrice.conversionRate - externalPriceId = newFloatingUnitWithPercentPrice.externalPriceId - fixedPriceQuantity = newFloatingUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithPercentPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingUnitWithPercentPrice.invoicingCycleConfiguration - metadata = newFloatingUnitWithPercentPrice.metadata - additionalProperties = - newFloatingUnitWithPercentPrice.additionalProperties.toMutableMap() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + currency = unitWithPercent.currency + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -40795,7 +40232,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -40810,8 +40247,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingUnitWithPercentPrice = - NewFloatingUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -40833,7 +40270,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -42002,7 +41439,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -42012,10 +41449,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewFloatingTieredWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -42401,7 +41838,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingTieredWithProrationPrice]. + * [TieredWithProration]. * * The following fields are required: * ```java @@ -42415,7 +41852,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingTieredWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -42440,29 +41877,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ) = apply { - cadence = newFloatingTieredWithProrationPrice.cadence - currency = newFloatingTieredWithProrationPrice.currency - itemId = newFloatingTieredWithProrationPrice.itemId - modelType = newFloatingTieredWithProrationPrice.modelType - name = newFloatingTieredWithProrationPrice.name - tieredWithProrationConfig = - newFloatingTieredWithProrationPrice.tieredWithProrationConfig - billableMetricId = newFloatingTieredWithProrationPrice.billableMetricId - billedInAdvance = newFloatingTieredWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredWithProrationPrice.billingCycleConfiguration - conversionRate = newFloatingTieredWithProrationPrice.conversionRate - externalPriceId = newFloatingTieredWithProrationPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithProrationPrice.invoiceGroupingKey + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + currency = tieredWithProration.currency + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingTieredWithProrationPrice.invoicingCycleConfiguration - metadata = newFloatingTieredWithProrationPrice.metadata + tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata additionalProperties = - newFloatingTieredWithProrationPrice.additionalProperties.toMutableMap() + tieredWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -42809,7 +42242,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingTieredWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -42824,8 +42257,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingTieredWithProrationPrice = - NewFloatingTieredWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -42847,7 +42280,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingTieredWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -44019,7 +43452,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -44029,10 +43462,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewFloatingUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -44417,7 +43850,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingUnitWithProrationPrice]. + * [UnitWithProration]. * * The following fields are required: * ```java @@ -44431,7 +43864,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -44455,29 +43888,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) = apply { - cadence = newFloatingUnitWithProrationPrice.cadence - currency = newFloatingUnitWithProrationPrice.currency - itemId = newFloatingUnitWithProrationPrice.itemId - modelType = newFloatingUnitWithProrationPrice.modelType - name = newFloatingUnitWithProrationPrice.name - unitWithProrationConfig = - newFloatingUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newFloatingUnitWithProrationPrice.billableMetricId - billedInAdvance = newFloatingUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newFloatingUnitWithProrationPrice.conversionRate - externalPriceId = newFloatingUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = newFloatingUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newFloatingUnitWithProrationPrice.metadata - additionalProperties = - newFloatingUnitWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + currency = unitWithProration.currency + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -44823,7 +44250,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -44838,8 +44265,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingUnitWithProrationPrice = - NewFloatingUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -44861,7 +44288,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -46033,7 +45460,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -46043,10 +45470,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewFloatingGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -46431,7 +45858,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedAllocationPrice]. + * [GroupedAllocation]. * * The following fields are required: * ```java @@ -46445,7 +45872,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -46469,29 +45896,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) = apply { - cadence = newFloatingGroupedAllocationPrice.cadence - currency = newFloatingGroupedAllocationPrice.currency - groupedAllocationConfig = - newFloatingGroupedAllocationPrice.groupedAllocationConfig - itemId = newFloatingGroupedAllocationPrice.itemId - modelType = newFloatingGroupedAllocationPrice.modelType - name = newFloatingGroupedAllocationPrice.name - billableMetricId = newFloatingGroupedAllocationPrice.billableMetricId - billedInAdvance = newFloatingGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedAllocationPrice.conversionRate - externalPriceId = newFloatingGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = newFloatingGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedAllocationPrice.metadata - additionalProperties = - newFloatingGroupedAllocationPrice.additionalProperties.toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + currency = groupedAllocation.currency + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -46837,7 +46258,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -46852,8 +46273,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedAllocationPrice = - NewFloatingGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("groupedAllocationConfig", groupedAllocationConfig), @@ -46875,7 +46296,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -48045,7 +47466,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -48055,10 +47476,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewFloatingGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -48447,7 +47868,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -48461,7 +47882,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -48488,36 +47909,29 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice - ) = apply { - cadence = newFloatingGroupedWithProratedMinimumPrice.cadence - currency = newFloatingGroupedWithProratedMinimumPrice.currency - groupedWithProratedMinimumConfig = - newFloatingGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - itemId = newFloatingGroupedWithProratedMinimumPrice.itemId - modelType = newFloatingGroupedWithProratedMinimumPrice.modelType - name = newFloatingGroupedWithProratedMinimumPrice.name - billableMetricId = - newFloatingGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = newFloatingGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedWithProratedMinimumPrice.conversionRate - externalPriceId = newFloatingGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = - newFloatingGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingGroupedWithProratedMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedWithProratedMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedWithProratedMinimumPrice.metadata - additionalProperties = - newFloatingGroupedWithProratedMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = + apply { + cadence = groupedWithProratedMinimum.cadence + currency = groupedWithProratedMinimum.currency + groupedWithProratedMinimumConfig = + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata + additionalProperties = + groupedWithProratedMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -48870,8 +48284,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewFloatingGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -48886,8 +48299,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedWithProratedMinimumPrice = - NewFloatingGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired( @@ -48912,7 +48325,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -50085,7 +49498,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -50095,10 +49508,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewFloatingGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -50487,7 +49900,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -50501,7 +49914,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -50528,36 +49941,29 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newFloatingGroupedWithMeteredMinimumPrice.cadence - currency = newFloatingGroupedWithMeteredMinimumPrice.currency - groupedWithMeteredMinimumConfig = - newFloatingGroupedWithMeteredMinimumPrice - .groupedWithMeteredMinimumConfig - itemId = newFloatingGroupedWithMeteredMinimumPrice.itemId - modelType = newFloatingGroupedWithMeteredMinimumPrice.modelType - name = newFloatingGroupedWithMeteredMinimumPrice.name - billableMetricId = - newFloatingGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = newFloatingGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingGroupedWithMeteredMinimumPrice.conversionRate - externalPriceId = newFloatingGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = - newFloatingGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingGroupedWithMeteredMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingGroupedWithMeteredMinimumPrice.metadata - additionalProperties = - newFloatingGroupedWithMeteredMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + apply { + cadence = groupedWithMeteredMinimum.cadence + currency = groupedWithMeteredMinimum.currency + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata + additionalProperties = + groupedWithMeteredMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -50909,7 +50315,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -50924,8 +50330,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedWithMeteredMinimumPrice = - NewFloatingGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired( @@ -50950,7 +50356,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -52123,7 +51529,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 */ @@ -52133,10 +51539,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithMeteredMinimum{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}" } - class NewFloatingMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -52522,7 +51928,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -52536,7 +51942,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -52562,32 +51968,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ) = apply { - cadence = newFloatingMatrixWithDisplayNamePrice.cadence - currency = newFloatingMatrixWithDisplayNamePrice.currency - itemId = newFloatingMatrixWithDisplayNamePrice.itemId + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + currency = matrixWithDisplayName.currency + itemId = matrixWithDisplayName.itemId matrixWithDisplayNameConfig = - newFloatingMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newFloatingMatrixWithDisplayNamePrice.modelType - name = newFloatingMatrixWithDisplayNamePrice.name - billableMetricId = newFloatingMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newFloatingMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newFloatingMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newFloatingMatrixWithDisplayNamePrice.conversionRate - externalPriceId = newFloatingMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = - newFloatingMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingMatrixWithDisplayNamePrice.invoiceGroupingKey + matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newFloatingMatrixWithDisplayNamePrice.metadata + matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata additionalProperties = - newFloatingMatrixWithDisplayNamePrice.additionalProperties - .toMutableMap() + matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -52935,7 +52335,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -52950,8 +52350,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingMatrixWithDisplayNamePrice = - NewFloatingMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -52976,7 +52376,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -54149,7 +53549,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 */ @@ -54159,10 +53559,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "MatrixWithDisplayName{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}" } - class NewFloatingBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -54547,7 +53947,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingBulkWithProrationPrice]. + * [BulkWithProration]. * * The following fields are required: * ```java @@ -54561,7 +53961,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -54585,29 +53985,23 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) = apply { - bulkWithProrationConfig = - newFloatingBulkWithProrationPrice.bulkWithProrationConfig - cadence = newFloatingBulkWithProrationPrice.cadence - currency = newFloatingBulkWithProrationPrice.currency - itemId = newFloatingBulkWithProrationPrice.itemId - modelType = newFloatingBulkWithProrationPrice.modelType - name = newFloatingBulkWithProrationPrice.name - billableMetricId = newFloatingBulkWithProrationPrice.billableMetricId - billedInAdvance = newFloatingBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newFloatingBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newFloatingBulkWithProrationPrice.conversionRate - externalPriceId = newFloatingBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = newFloatingBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newFloatingBulkWithProrationPrice.metadata - additionalProperties = - newFloatingBulkWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + currency = bulkWithProration.currency + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = @@ -54953,7 +54347,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -54968,8 +54362,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingBulkWithProrationPrice = - NewFloatingBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("currency", currency), @@ -54991,7 +54385,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -56163,7 +55557,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -56173,10 +55567,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewFloatingGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -56562,7 +55956,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingGroupedTieredPackagePrice]. + * [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -56576,7 +55970,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -56601,29 +55995,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ) = apply { - cadence = newFloatingGroupedTieredPackagePrice.cadence - currency = newFloatingGroupedTieredPackagePrice.currency - groupedTieredPackageConfig = - newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newFloatingGroupedTieredPackagePrice.itemId - modelType = newFloatingGroupedTieredPackagePrice.modelType - name = newFloatingGroupedTieredPackagePrice.name - billableMetricId = newFloatingGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newFloatingGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newFloatingGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate - externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + currency = groupedTieredPackage.currency + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newFloatingGroupedTieredPackagePrice.metadata + groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata additionalProperties = - newFloatingGroupedTieredPackagePrice.additionalProperties.toMutableMap() + groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -56971,7 +56361,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -56986,8 +56376,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingGroupedTieredPackagePrice = - NewFloatingGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), @@ -57009,7 +56399,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -58181,7 +57571,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedTieredPackage && 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 */ @@ -58191,10 +57581,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedTieredPackage{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}" } - class NewFloatingScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -58585,7 +57975,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -58599,7 +57989,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -58627,38 +58017,28 @@ private constructor( @JvmSynthetic internal fun from( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = apply { - cadence = newFloatingScalableMatrixWithUnitPricingPrice.cadence - currency = newFloatingScalableMatrixWithUnitPricingPrice.currency - itemId = newFloatingScalableMatrixWithUnitPricingPrice.itemId - modelType = newFloatingScalableMatrixWithUnitPricingPrice.modelType - name = newFloatingScalableMatrixWithUnitPricingPrice.name + cadence = scalableMatrixWithUnitPricing.cadence + currency = scalableMatrixWithUnitPricing.currency + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name scalableMatrixWithUnitPricingConfig = - newFloatingScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = - newFloatingScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = - newFloatingScalableMatrixWithUnitPricingPrice.billedInAdvance + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance billingCycleConfiguration = - newFloatingScalableMatrixWithUnitPricingPrice.billingCycleConfiguration - conversionRate = - newFloatingScalableMatrixWithUnitPricingPrice.conversionRate - externalPriceId = - newFloatingScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newFloatingScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingScalableMatrixWithUnitPricingPrice.invoiceGroupingKey + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingScalableMatrixWithUnitPricingPrice - .invoicingCycleConfiguration - metadata = newFloatingScalableMatrixWithUnitPricingPrice.metadata + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata additionalProperties = - newFloatingScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -59014,8 +58394,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewFloatingScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -59030,8 +58409,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingScalableMatrixWithUnitPricingPrice = - NewFloatingScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -59056,7 +58435,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -60231,7 +59610,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingScalableMatrixWithUnitPricingPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -60241,10 +59620,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingScalableMatrixWithUnitPricingPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewFloatingScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val currency: JsonField, @@ -60635,7 +60014,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -60649,7 +60028,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -60677,39 +60056,28 @@ private constructor( @JvmSynthetic internal fun from( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newFloatingScalableMatrixWithTieredPricingPrice.cadence - currency = newFloatingScalableMatrixWithTieredPricingPrice.currency - itemId = newFloatingScalableMatrixWithTieredPricingPrice.itemId - modelType = newFloatingScalableMatrixWithTieredPricingPrice.modelType - name = newFloatingScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + currency = scalableMatrixWithTieredPricing.currency + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newFloatingScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = - newFloatingScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = - newFloatingScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newFloatingScalableMatrixWithTieredPricingPrice - .billingCycleConfiguration - conversionRate = - newFloatingScalableMatrixWithTieredPricingPrice.conversionRate - externalPriceId = - newFloatingScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newFloatingScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingScalableMatrixWithTieredPricingPrice - .invoicingCycleConfiguration - metadata = newFloatingScalableMatrixWithTieredPricingPrice.metadata + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata additionalProperties = - newFloatingScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -61065,8 +60433,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewFloatingScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -61081,8 +60448,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingScalableMatrixWithTieredPricingPrice = - NewFloatingScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -61107,7 +60474,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -62286,7 +61653,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingScalableMatrixWithTieredPricingPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -62296,10 +61663,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingScalableMatrixWithTieredPricingPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class NewFloatingCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -62685,7 +62052,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewFloatingCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -62699,7 +62066,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewFloatingCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -62725,32 +62092,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ) = apply { - cadence = newFloatingCumulativeGroupedBulkPrice.cadence + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence cumulativeGroupedBulkConfig = - newFloatingCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - currency = newFloatingCumulativeGroupedBulkPrice.currency - itemId = newFloatingCumulativeGroupedBulkPrice.itemId - modelType = newFloatingCumulativeGroupedBulkPrice.modelType - name = newFloatingCumulativeGroupedBulkPrice.name - billableMetricId = newFloatingCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newFloatingCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newFloatingCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newFloatingCumulativeGroupedBulkPrice.conversionRate - externalPriceId = newFloatingCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = - newFloatingCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingCumulativeGroupedBulkPrice.invoiceGroupingKey + cumulativeGroupedBulk.cumulativeGroupedBulkConfig + currency = cumulativeGroupedBulk.currency + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey invoicingCycleConfiguration = - newFloatingCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newFloatingCumulativeGroupedBulkPrice.metadata + cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata additionalProperties = - newFloatingCumulativeGroupedBulkPrice.additionalProperties - .toMutableMap() + cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -63098,7 +62459,7 @@ private constructor( } /** - * Returns an immutable instance of [NewFloatingCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -63113,8 +62474,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewFloatingCumulativeGroupedBulkPrice = - NewFloatingCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired( "cumulativeGroupedBulkConfig", @@ -63139,7 +62500,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewFloatingCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -64312,7 +63673,7 @@ private constructor( return true } - return /* spotless:off */ other is NewFloatingCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -64322,7 +63683,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" } } @@ -64476,32 +63837,26 @@ private constructor( /** * Alias for calling [adjustment] with - * `Adjustment.ofNewPercentageDiscount(newPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = - adjustment(Adjustment.ofNewPercentageDiscount(newPercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewUsageDiscount(newUsageDiscount)`. - */ - fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = - adjustment(Adjustment.ofNewUsageDiscount(newUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewAmountDiscount(newAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = - adjustment(Adjustment.ofNewAmountDiscount(newAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMinimum(newMinimum)`. */ - fun adjustment(newMinimum: Adjustment.NewMinimum) = - adjustment(Adjustment.ofNewMinimum(newMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMaximum(newMaximum)`. */ - fun adjustment(newMaximum: Adjustment.NewMaximum) = - adjustment(Adjustment.ofNewMaximum(newMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** * The start date of the adjustment interval. This is the date that the adjustment will @@ -64639,60 +63994,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val newPercentageDiscount: NewPercentageDiscount? = null, - private val newUsageDiscount: NewUsageDiscount? = null, - private val newAmountDiscount: NewAmountDiscount? = null, - private val newMinimum: NewMinimum? = null, - private val newMaximum: NewMaximum? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun newPercentageDiscount(): Optional = - Optional.ofNullable(newPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun newUsageDiscount(): Optional = - Optional.ofNullable(newUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun newAmountDiscount(): Optional = - Optional.ofNullable(newAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun newMinimum(): Optional = Optional.ofNullable(newMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun newMaximum(): Optional = Optional.ofNullable(newMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isNewPercentageDiscount(): Boolean = newPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isNewUsageDiscount(): Boolean = newUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isNewAmountDiscount(): Boolean = newAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isNewMinimum(): Boolean = newMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isNewMaximum(): Boolean = newMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asNewPercentageDiscount(): NewPercentageDiscount = - newPercentageDiscount.getOrThrow("newPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asNewUsageDiscount(): NewUsageDiscount = - newUsageDiscount.getOrThrow("newUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asNewAmountDiscount(): NewAmountDiscount = - newAmountDiscount.getOrThrow("newAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asNewMinimum(): NewMinimum = newMinimum.getOrThrow("newMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asNewMaximum(): NewMaximum = newMaximum.getOrThrow("newMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newPercentageDiscount != null -> - visitor.visitNewPercentageDiscount(newPercentageDiscount) - newUsageDiscount != null -> visitor.visitNewUsageDiscount(newUsageDiscount) - newAmountDiscount != null -> visitor.visitNewAmountDiscount(newAmountDiscount) - newMinimum != null -> visitor.visitNewMinimum(newMinimum) - newMaximum != null -> visitor.visitNewMaximum(newMaximum) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -64705,26 +64056,26 @@ private constructor( accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - newPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) { - newUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) { - newAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitNewMinimum(newMinimum: NewMinimum) { - newMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitNewMaximum(newMaximum: NewMaximum) { - newMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -64749,19 +64100,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount - ) = newPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - newUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - newAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitNewMinimum(newMinimum: NewMinimum) = newMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitNewMaximum(newMaximum: NewMaximum) = newMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -64772,19 +64123,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && newPercentageDiscount == other.newPercentageDiscount && newUsageDiscount == other.newUsageDiscount && newAmountDiscount == other.newAmountDiscount && newMinimum == other.newMinimum && newMaximum == other.newMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPercentageDiscount, newUsageDiscount, newAmountDiscount, newMinimum, newMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentageDiscount, usageDiscount, amountDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - newPercentageDiscount != null -> - "Adjustment{newPercentageDiscount=$newPercentageDiscount}" - newUsageDiscount != null -> "Adjustment{newUsageDiscount=$newUsageDiscount}" - newAmountDiscount != null -> "Adjustment{newAmountDiscount=$newAmountDiscount}" - newMinimum != null -> "Adjustment{newMinimum=$newMinimum}" - newMaximum != null -> "Adjustment{newMaximum=$newMaximum}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -64792,22 +64143,20 @@ private constructor( companion object { @JvmStatic - fun ofNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount) = - Adjustment(newPercentageDiscount = newPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) @JvmStatic - fun ofNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - Adjustment(newUsageDiscount = newUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - Adjustment(newAmountDiscount = newAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) - @JvmStatic - fun ofNewMinimum(newMinimum: NewMinimum) = Adjustment(newMinimum = newMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofNewMaximum(newMaximum: NewMaximum) = Adjustment(newMaximum = newMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -64816,15 +64165,15 @@ private constructor( */ interface Visitor { - fun visitNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitNewMinimum(newMinimum: NewMinimum): T + fun visitMinimum(minimum: Minimum): T - fun visitNewMaximum(newMaximum: NewMaximum): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -64850,28 +64199,28 @@ private constructor( when (adjustmentType) { "percentage_discount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(newPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "usage_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newUsageDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newAmountDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMinimum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMaximum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) } ?: Adjustment(_json = json) } } @@ -64888,21 +64237,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.newPercentageDiscount != null -> - generator.writeObject(value.newPercentageDiscount) - value.newUsageDiscount != null -> - generator.writeObject(value.newUsageDiscount) - value.newAmountDiscount != null -> - generator.writeObject(value.newAmountDiscount) - value.newMinimum != null -> generator.writeObject(value.newMinimum) - value.newMaximum != null -> generator.writeObject(value.newMaximum) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class NewPercentageDiscount + class PercentageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -65020,7 +64367,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPercentageDiscount]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -65031,7 +64378,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPercentageDiscount]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") @@ -65041,14 +64388,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - adjustmentType = newPercentageDiscount.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - newPercentageDiscount.appliesToPriceIds.map { it.toMutableList() } - percentageDiscount = newPercentageDiscount.percentageDiscount - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.percentageDiscount = percentageDiscount.percentageDiscount + isInvoiceLevel = percentageDiscount.isInvoiceLevel additionalProperties = - newPercentageDiscount.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } /** @@ -65149,7 +64496,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPercentageDiscount]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65161,8 +64508,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPercentageDiscount = - NewPercentageDiscount( + fun build(): PercentageDiscount = + PercentageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -65175,7 +64522,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPercentageDiscount = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -65221,7 +64568,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65231,10 +64578,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "PercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewUsageDiscount + class UsageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -65350,7 +64697,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewUsageDiscount]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -65361,7 +64708,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewUsageDiscount]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("usage_discount") @@ -65371,13 +64718,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - adjustmentType = newUsageDiscount.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - newUsageDiscount.appliesToPriceIds.map { it.toMutableList() } - usageDiscount = newUsageDiscount.usageDiscount - isInvoiceLevel = newUsageDiscount.isInvoiceLevel - additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.usageDiscount = usageDiscount.usageDiscount + isInvoiceLevel = usageDiscount.isInvoiceLevel + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } /** @@ -65478,7 +64825,7 @@ private constructor( } /** - * Returns an immutable instance of [NewUsageDiscount]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65490,8 +64837,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewUsageDiscount = - NewUsageDiscount( + fun build(): UsageDiscount = + UsageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -65504,7 +64851,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewUsageDiscount = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -65548,7 +64895,7 @@ private constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65558,10 +64905,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "UsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewAmountDiscount + class AmountDiscount private constructor( private val adjustmentType: JsonValue, private val amountDiscount: JsonField, @@ -65677,8 +65024,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAmountDiscount]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -65689,7 +65035,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAmountDiscount]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("amount_discount") @@ -65699,13 +65045,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - adjustmentType = newAmountDiscount.adjustmentType - amountDiscount = newAmountDiscount.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - newAmountDiscount.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = newAmountDiscount.isInvoiceLevel - additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } /** @@ -65806,7 +65152,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAmountDiscount]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65818,8 +65164,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAmountDiscount = - NewAmountDiscount( + fun build(): AmountDiscount = + AmountDiscount( adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -65832,7 +65178,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAmountDiscount = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -65876,7 +65222,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65886,10 +65232,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "AmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMinimum + class Minimum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -66027,7 +65373,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMinimum]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -66039,7 +65385,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMinimum]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("minimum") @@ -66050,13 +65396,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMinimum: NewMinimum) = apply { - adjustmentType = newMinimum.adjustmentType - appliesToPriceIds = newMinimum.appliesToPriceIds.map { it.toMutableList() } - itemId = newMinimum.itemId - minimumAmount = newMinimum.minimumAmount - isInvoiceLevel = newMinimum.isInvoiceLevel - additionalProperties = newMinimum.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + isInvoiceLevel = minimum.isInvoiceLevel + additionalProperties = minimum.additionalProperties.toMutableMap() } /** @@ -66169,7 +65515,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMinimum]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -66182,8 +65528,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMinimum = - NewMinimum( + fun build(): Minimum = + Minimum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -66197,7 +65543,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMinimum = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -66243,7 +65589,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Minimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -66253,10 +65599,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Minimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMaximum + class Maximum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -66372,7 +65718,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMaximum]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -66383,7 +65729,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMaximum]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("maximum") @@ -66393,12 +65739,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMaximum: NewMaximum) = apply { - adjustmentType = newMaximum.adjustmentType - appliesToPriceIds = newMaximum.appliesToPriceIds.map { it.toMutableList() } - maximumAmount = newMaximum.maximumAmount - isInvoiceLevel = newMaximum.isInvoiceLevel - additionalProperties = newMaximum.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + maximumAmount = maximum.maximumAmount + isInvoiceLevel = maximum.isInvoiceLevel + additionalProperties = maximum.additionalProperties.toMutableMap() } /** @@ -66499,7 +65845,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMaximum]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -66511,8 +65857,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMaximum = - NewMaximum( + fun build(): Maximum = + Maximum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -66525,7 +65871,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMaximum = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -66569,7 +65915,7 @@ private constructor( return true } - return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -66579,7 +65925,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Maximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } 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 eaca322ab..37aa00afc 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 @@ -1067,17 +1067,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1721,41 +1721,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1904,66 +1891,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1976,34 +1953,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2028,25 +1997,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2057,21 +2020,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2079,27 +2040,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2108,21 +2062,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2148,44 +2096,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2201,23 +2134,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2398,8 +2327,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2414,7 +2342,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2427,21 +2355,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2602,7 +2525,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2618,8 +2541,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2635,7 +2558,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2687,7 +2610,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2697,10 +2620,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2881,8 +2804,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2897,7 +2819,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2910,21 +2832,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3085,7 +3002,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3101,8 +3018,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3118,7 +3035,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3170,7 +3087,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3180,10 +3097,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3366,7 +3283,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3381,7 +3298,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3394,23 +3311,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3571,7 +3482,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3587,8 +3498,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3604,7 +3515,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3656,7 +3567,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3666,10 +3577,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3872,8 +3783,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3889,7 +3799,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3903,22 +3813,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4090,7 +3995,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4107,8 +4012,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4125,7 +4030,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4177,7 +4082,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4187,10 +4092,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4371,8 +4276,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4387,7 +4291,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4400,21 +4304,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4574,7 +4473,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4590,8 +4489,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4607,7 +4506,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4657,7 +4556,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4667,7 +4566,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4960,17 +4859,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4978,11 +4877,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5003,15 +4902,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5037,12 +4936,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5069,14 +4967,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5085,11 +4981,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5115,17 +5011,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5152,7 +5048,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5316,8 +5212,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5331,7 +5226,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5343,17 +5238,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5496,7 +5389,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5511,8 +5404,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5529,7 +5422,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5575,7 +5468,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5585,10 +5478,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5752,8 +5645,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5767,7 +5659,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5779,19 +5671,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5936,7 +5824,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5951,8 +5839,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5969,7 +5857,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6015,7 +5903,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6025,10 +5913,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6193,8 +6081,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6208,7 +6095,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6220,16 +6107,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6375,7 +6261,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6390,8 +6276,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6408,7 +6294,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6454,7 +6340,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6464,7 +6350,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8264,142 +8150,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 b01f19960..eed2edfe0 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 @@ -3497,32 +3497,26 @@ private constructor( /** * Alias for calling [adjustment] with - * `Adjustment.ofNewPercentageDiscount(newPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = - adjustment(Adjustment.ofNewPercentageDiscount(newPercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewUsageDiscount(newUsageDiscount)`. - */ - fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = - adjustment(Adjustment.ofNewUsageDiscount(newUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewAmountDiscount(newAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = - adjustment(Adjustment.ofNewAmountDiscount(newAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMinimum(newMinimum)`. */ - fun adjustment(newMinimum: Adjustment.NewMinimum) = - adjustment(Adjustment.ofNewMinimum(newMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMaximum(newMaximum)`. */ - fun adjustment(newMaximum: Adjustment.NewMaximum) = - adjustment(Adjustment.ofNewMaximum(newMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** * The end date of the adjustment interval. This is the date that the adjustment will @@ -3670,60 +3664,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val newPercentageDiscount: NewPercentageDiscount? = null, - private val newUsageDiscount: NewUsageDiscount? = null, - private val newAmountDiscount: NewAmountDiscount? = null, - private val newMinimum: NewMinimum? = null, - private val newMaximum: NewMaximum? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun newPercentageDiscount(): Optional = - Optional.ofNullable(newPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun newUsageDiscount(): Optional = - Optional.ofNullable(newUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun newAmountDiscount(): Optional = - Optional.ofNullable(newAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun newMinimum(): Optional = Optional.ofNullable(newMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun newMaximum(): Optional = Optional.ofNullable(newMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isNewPercentageDiscount(): Boolean = newPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isNewUsageDiscount(): Boolean = newUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isNewAmountDiscount(): Boolean = newAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isNewMinimum(): Boolean = newMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isNewMaximum(): Boolean = newMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asNewPercentageDiscount(): NewPercentageDiscount = - newPercentageDiscount.getOrThrow("newPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asNewUsageDiscount(): NewUsageDiscount = - newUsageDiscount.getOrThrow("newUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asNewAmountDiscount(): NewAmountDiscount = - newAmountDiscount.getOrThrow("newAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asNewMinimum(): NewMinimum = newMinimum.getOrThrow("newMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asNewMaximum(): NewMaximum = newMaximum.getOrThrow("newMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newPercentageDiscount != null -> - visitor.visitNewPercentageDiscount(newPercentageDiscount) - newUsageDiscount != null -> visitor.visitNewUsageDiscount(newUsageDiscount) - newAmountDiscount != null -> visitor.visitNewAmountDiscount(newAmountDiscount) - newMinimum != null -> visitor.visitNewMinimum(newMinimum) - newMaximum != null -> visitor.visitNewMaximum(newMaximum) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -3736,26 +3726,26 @@ private constructor( accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - newPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) { - newUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) { - newAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitNewMinimum(newMinimum: NewMinimum) { - newMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitNewMaximum(newMaximum: NewMaximum) { - newMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -3780,19 +3770,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount - ) = newPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - newUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - newAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitNewMinimum(newMinimum: NewMinimum) = newMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitNewMaximum(newMaximum: NewMaximum) = newMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -3803,19 +3793,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && newPercentageDiscount == other.newPercentageDiscount && newUsageDiscount == other.newUsageDiscount && newAmountDiscount == other.newAmountDiscount && newMinimum == other.newMinimum && newMaximum == other.newMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPercentageDiscount, newUsageDiscount, newAmountDiscount, newMinimum, newMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentageDiscount, usageDiscount, amountDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - newPercentageDiscount != null -> - "Adjustment{newPercentageDiscount=$newPercentageDiscount}" - newUsageDiscount != null -> "Adjustment{newUsageDiscount=$newUsageDiscount}" - newAmountDiscount != null -> "Adjustment{newAmountDiscount=$newAmountDiscount}" - newMinimum != null -> "Adjustment{newMinimum=$newMinimum}" - newMaximum != null -> "Adjustment{newMaximum=$newMaximum}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -3823,22 +3813,20 @@ private constructor( companion object { @JvmStatic - fun ofNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount) = - Adjustment(newPercentageDiscount = newPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) @JvmStatic - fun ofNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - Adjustment(newUsageDiscount = newUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - Adjustment(newAmountDiscount = newAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) - @JvmStatic - fun ofNewMinimum(newMinimum: NewMinimum) = Adjustment(newMinimum = newMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofNewMaximum(newMaximum: NewMaximum) = Adjustment(newMaximum = newMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -3847,15 +3835,15 @@ private constructor( */ interface Visitor { - fun visitNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitNewMinimum(newMinimum: NewMinimum): T + fun visitMinimum(minimum: Minimum): T - fun visitNewMaximum(newMaximum: NewMaximum): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -3881,28 +3869,28 @@ private constructor( when (adjustmentType) { "percentage_discount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(newPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "usage_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newUsageDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newAmountDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMinimum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMaximum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) } ?: Adjustment(_json = json) } } @@ -3919,21 +3907,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.newPercentageDiscount != null -> - generator.writeObject(value.newPercentageDiscount) - value.newUsageDiscount != null -> - generator.writeObject(value.newUsageDiscount) - value.newAmountDiscount != null -> - generator.writeObject(value.newAmountDiscount) - value.newMinimum != null -> generator.writeObject(value.newMinimum) - value.newMaximum != null -> generator.writeObject(value.newMaximum) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class NewPercentageDiscount + class PercentageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -4051,7 +4037,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPercentageDiscount]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -4062,7 +4048,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPercentageDiscount]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") @@ -4072,14 +4058,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - adjustmentType = newPercentageDiscount.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - newPercentageDiscount.appliesToPriceIds.map { it.toMutableList() } - percentageDiscount = newPercentageDiscount.percentageDiscount - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.percentageDiscount = percentageDiscount.percentageDiscount + isInvoiceLevel = percentageDiscount.isInvoiceLevel additionalProperties = - newPercentageDiscount.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } /** @@ -4180,7 +4166,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPercentageDiscount]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4192,8 +4178,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPercentageDiscount = - NewPercentageDiscount( + fun build(): PercentageDiscount = + PercentageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -4206,7 +4192,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPercentageDiscount = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -4252,7 +4238,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4262,10 +4248,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "PercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewUsageDiscount + class UsageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -4381,7 +4367,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewUsageDiscount]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -4392,7 +4378,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewUsageDiscount]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("usage_discount") @@ -4402,13 +4388,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - adjustmentType = newUsageDiscount.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - newUsageDiscount.appliesToPriceIds.map { it.toMutableList() } - usageDiscount = newUsageDiscount.usageDiscount - isInvoiceLevel = newUsageDiscount.isInvoiceLevel - additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.usageDiscount = usageDiscount.usageDiscount + isInvoiceLevel = usageDiscount.isInvoiceLevel + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } /** @@ -4509,7 +4495,7 @@ private constructor( } /** - * Returns an immutable instance of [NewUsageDiscount]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4521,8 +4507,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewUsageDiscount = - NewUsageDiscount( + fun build(): UsageDiscount = + UsageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -4535,7 +4521,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewUsageDiscount = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -4579,7 +4565,7 @@ private constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4589,10 +4575,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "UsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewAmountDiscount + class AmountDiscount private constructor( private val adjustmentType: JsonValue, private val amountDiscount: JsonField, @@ -4708,8 +4694,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAmountDiscount]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -4720,7 +4705,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAmountDiscount]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("amount_discount") @@ -4730,13 +4715,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - adjustmentType = newAmountDiscount.adjustmentType - amountDiscount = newAmountDiscount.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - newAmountDiscount.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = newAmountDiscount.isInvoiceLevel - additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } /** @@ -4837,7 +4822,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAmountDiscount]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4849,8 +4834,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAmountDiscount = - NewAmountDiscount( + fun build(): AmountDiscount = + AmountDiscount( adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4863,7 +4848,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAmountDiscount = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -4907,7 +4892,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -4917,10 +4902,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "AmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMinimum + class Minimum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -5058,7 +5043,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMinimum]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -5070,7 +5055,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMinimum]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("minimum") @@ -5081,13 +5066,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMinimum: NewMinimum) = apply { - adjustmentType = newMinimum.adjustmentType - appliesToPriceIds = newMinimum.appliesToPriceIds.map { it.toMutableList() } - itemId = newMinimum.itemId - minimumAmount = newMinimum.minimumAmount - isInvoiceLevel = newMinimum.isInvoiceLevel - additionalProperties = newMinimum.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + isInvoiceLevel = minimum.isInvoiceLevel + additionalProperties = minimum.additionalProperties.toMutableMap() } /** @@ -5200,7 +5185,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMinimum]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5213,8 +5198,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMinimum = - NewMinimum( + fun build(): Minimum = + Minimum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5228,7 +5213,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMinimum = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -5274,7 +5259,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Minimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -5284,10 +5269,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Minimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMaximum + class Maximum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -5403,7 +5388,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMaximum]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -5414,7 +5399,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMaximum]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("maximum") @@ -5424,12 +5409,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMaximum: NewMaximum) = apply { - adjustmentType = newMaximum.adjustmentType - appliesToPriceIds = newMaximum.appliesToPriceIds.map { it.toMutableList() } - maximumAmount = newMaximum.maximumAmount - isInvoiceLevel = newMaximum.isInvoiceLevel - additionalProperties = newMaximum.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + maximumAmount = maximum.maximumAmount + isInvoiceLevel = maximum.isInvoiceLevel + additionalProperties = maximum.additionalProperties.toMutableMap() } /** @@ -5530,7 +5515,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMaximum]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5542,8 +5527,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMaximum = - NewMaximum( + fun build(): Maximum = + Maximum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5556,7 +5541,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMaximum = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -5600,7 +5585,7 @@ private constructor( return true } - return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -5610,7 +5595,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Maximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -6102,244 +6087,127 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** - * Alias for calling [price] with `Price.ofNewSubscriptionUnit(newSubscriptionUnit)`. - */ - fun price(newSubscriptionUnit: Price.NewSubscriptionUnitPrice) = - price(Price.ofNewSubscriptionUnit(newSubscriptionUnit)) + /** Alias for calling [price] with `Price.ofUnit(unit)`. */ + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionPackage(newSubscriptionPackage)`. - */ - fun price(newSubscriptionPackage: Price.NewSubscriptionPackagePrice) = - price(Price.ofNewSubscriptionPackage(newSubscriptionPackage)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)`. - */ - fun price(newSubscriptionMatrix: Price.NewSubscriptionMatrixPrice) = - price(Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)) + /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTiered(newSubscriptionTiered)`. - */ - fun price(newSubscriptionTiered: Price.NewSubscriptionTieredPrice) = - price(Price.ofNewSubscriptionTiered(newSubscriptionTiered)) + /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)`. - */ - fun price(newSubscriptionTieredBps: Price.NewSubscriptionTieredBpsPrice) = - price(Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)) + /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) - /** Alias for calling [price] with `Price.ofNewSubscriptionBps(newSubscriptionBps)`. */ - fun price(newSubscriptionBps: Price.NewSubscriptionBpsPrice) = - price(Price.ofNewSubscriptionBps(newSubscriptionBps)) + /** Alias for calling [price] with `Price.ofBps(bps)`. */ + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)`. - */ - fun price(newSubscriptionBulkBps: Price.NewSubscriptionBulkBpsPrice) = - price(Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)) + /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) - /** - * Alias for calling [price] with `Price.ofNewSubscriptionBulk(newSubscriptionBulk)`. - */ - fun price(newSubscriptionBulk: Price.NewSubscriptionBulkPrice) = - price(Price.ofNewSubscriptionBulk(newSubscriptionBulk)) + /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount)`. + * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price( - newSubscriptionThresholdTotalAmount: Price.NewSubscriptionThresholdTotalAmountPrice - ) = - price( - Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount) - ) + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = + price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)`. - */ - fun price(newSubscriptionTieredPackage: Price.NewSubscriptionTieredPackagePrice) = - price(Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)) + /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ + fun price(tieredPackage: Price.TieredPackage) = + price(Price.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)`. - */ - fun price( - newSubscriptionTieredWithMinimum: Price.NewSubscriptionTieredWithMinimumPrice - ) = price(Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)) + /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun price(tieredWithMinimum: Price.TieredWithMinimum) = + price(Price.ofTieredWithMinimum(tieredWithMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)`. - */ - fun price(newSubscriptionUnitWithPercent: Price.NewSubscriptionUnitWithPercentPrice) = - price(Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)) + /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun price(unitWithPercent: Price.UnitWithPercent) = + price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionPackageWithAllocation(newSubscriptionPackageWithAllocation)`. + * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price( - newSubscriptionPackageWithAllocation: - Price.NewSubscriptionPackageWithAllocationPrice - ) = - price( - Price.ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - ) + fun price(packageWithAllocation: Price.PackageWithAllocation) = + price(Price.ofPackageWithAllocation(packageWithAllocation)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)`. + * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price( - newSubscriptionTierWithProration: Price.NewSubscriptionTierWithProrationPrice - ) = price(Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)) + fun price(tieredWithProration: Price.TieredWithProration) = + price(Price.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)`. - */ - fun price( - newSubscriptionUnitWithProration: Price.NewSubscriptionUnitWithProrationPrice - ) = price(Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)) + /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun price(unitWithProration: Price.UnitWithProration) = + price(Price.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)`. - */ - fun price( - newSubscriptionGroupedAllocation: Price.NewSubscriptionGroupedAllocationPrice - ) = price(Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)) + /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun price(groupedAllocation: Price.GroupedAllocation) = + price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithProratedMinimum(newSubscriptionGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price( - newSubscriptionGroupedWithProratedMinimum: - Price.NewSubscriptionGroupedWithProratedMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - ) + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = + price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)`. - */ - fun price( - newSubscriptionBulkWithProration: Price.NewSubscriptionBulkWithProrationPrice - ) = price(Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)) + /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun price(bulkWithProration: Price.BulkWithProration) = + price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithUnitPricing(newSubscriptionScalableMatrixWithUnitPricing)`. + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithUnitPricing: - Price.NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - ) + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = + price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithTieredPricing(newSubscriptionScalableMatrixWithTieredPricing)`. + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithTieredPricing: - Price.NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - ) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionCumulativeGroupedBulk(newSubscriptionCumulativeGroupedBulk)`. + * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price( - newSubscriptionCumulativeGroupedBulk: - Price.NewSubscriptionCumulativeGroupedBulkPrice - ) = - price( - Price.ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - ) + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = + price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMaxGroupTieredPackage(newSubscriptionMaxGroupTieredPackage)`. + * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price( - newSubscriptionMaxGroupTieredPackage: - Price.NewSubscriptionMaxGroupTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - ) + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = + price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithMeteredMinimum(newSubscriptionGroupedWithMeteredMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price( - newSubscriptionGroupedWithMeteredMinimum: - Price.NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - ) + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = + price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrixWithDisplayName(newSubscriptionMatrixWithDisplayName)`. + * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price( - newSubscriptionMatrixWithDisplayName: - Price.NewSubscriptionMatrixWithDisplayNamePrice - ) = - price( - Price.ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - ) + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = + price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage)`. + * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price( - newSubscriptionGroupedTieredPackage: Price.NewSubscriptionGroupedTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage) - ) + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = + price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** The id of the price to add to the subscription. */ fun priceId(priceId: String?) = priceId(JsonField.ofNullable(priceId)) @@ -7407,401 +7275,257 @@ private constructor( @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val newSubscriptionUnit: NewSubscriptionUnitPrice? = null, - private val newSubscriptionPackage: NewSubscriptionPackagePrice? = null, - private val newSubscriptionMatrix: NewSubscriptionMatrixPrice? = null, - private val newSubscriptionTiered: NewSubscriptionTieredPrice? = null, - private val newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice? = null, - private val newSubscriptionBps: NewSubscriptionBpsPrice? = null, - private val newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice? = null, - private val newSubscriptionBulk: NewSubscriptionBulkPrice? = null, - private val newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice? = - null, - private val newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice? = null, - private val newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice? = - null, - private val newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice? = null, - private val newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice? = - null, - private val newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice? = - null, - private val newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice? = - null, - private val newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice? = - null, - private val newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice? = - null, - private val newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice? = - null, - private val newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice? = - null, - private val newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice? = - null, - private val newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice? = - null, - private val newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice? = - null, - private val newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice? = - null, - private val newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice? = - null, - private val newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice? = - null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val bulkWithProration: BulkWithProration? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, private val _json: JsonValue? = null, ) { - fun newSubscriptionUnit(): Optional = - Optional.ofNullable(newSubscriptionUnit) + fun unit(): Optional = Optional.ofNullable(unit) - fun newSubscriptionPackage(): Optional = - Optional.ofNullable(newSubscriptionPackage) + fun package_(): Optional = Optional.ofNullable(package_) - fun newSubscriptionMatrix(): Optional = - Optional.ofNullable(newSubscriptionMatrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newSubscriptionTiered(): Optional = - Optional.ofNullable(newSubscriptionTiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newSubscriptionTieredBps(): Optional = - Optional.ofNullable(newSubscriptionTieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newSubscriptionBps(): Optional = - Optional.ofNullable(newSubscriptionBps) + fun bps(): Optional = Optional.ofNullable(bps) - fun newSubscriptionBulkBps(): Optional = - Optional.ofNullable(newSubscriptionBulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newSubscriptionBulk(): Optional = - Optional.ofNullable(newSubscriptionBulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newSubscriptionThresholdTotalAmount(): - Optional = - Optional.ofNullable(newSubscriptionThresholdTotalAmount) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newSubscriptionTieredPackage(): Optional = - Optional.ofNullable(newSubscriptionTieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newSubscriptionTieredWithMinimum(): - Optional = - Optional.ofNullable(newSubscriptionTieredWithMinimum) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newSubscriptionUnitWithPercent(): Optional = - Optional.ofNullable(newSubscriptionUnitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newSubscriptionPackageWithAllocation(): - Optional = - Optional.ofNullable(newSubscriptionPackageWithAllocation) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newSubscriptionTierWithProration(): - Optional = - Optional.ofNullable(newSubscriptionTierWithProration) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newSubscriptionUnitWithProration(): - Optional = - Optional.ofNullable(newSubscriptionUnitWithProration) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newSubscriptionGroupedAllocation(): - Optional = - Optional.ofNullable(newSubscriptionGroupedAllocation) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newSubscriptionGroupedWithProratedMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithProratedMinimum) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newSubscriptionBulkWithProration(): - Optional = - Optional.ofNullable(newSubscriptionBulkWithProration) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newSubscriptionScalableMatrixWithUnitPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithUnitPricing) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newSubscriptionScalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithTieredPricing) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newSubscriptionCumulativeGroupedBulk(): - Optional = - Optional.ofNullable(newSubscriptionCumulativeGroupedBulk) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun newSubscriptionMaxGroupTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionMaxGroupTieredPackage) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newSubscriptionGroupedWithMeteredMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithMeteredMinimum) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newSubscriptionMatrixWithDisplayName(): - Optional = - Optional.ofNullable(newSubscriptionMatrixWithDisplayName) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newSubscriptionGroupedTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionGroupedTieredPackage) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun isNewSubscriptionUnit(): Boolean = newSubscriptionUnit != null + fun isUnit(): Boolean = unit != null - fun isNewSubscriptionPackage(): Boolean = newSubscriptionPackage != null + fun isPackage(): Boolean = package_ != null - fun isNewSubscriptionMatrix(): Boolean = newSubscriptionMatrix != null + fun isMatrix(): Boolean = matrix != null - fun isNewSubscriptionTiered(): Boolean = newSubscriptionTiered != null + fun isTiered(): Boolean = tiered != null - fun isNewSubscriptionTieredBps(): Boolean = newSubscriptionTieredBps != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewSubscriptionBps(): Boolean = newSubscriptionBps != null + fun isBps(): Boolean = bps != null - fun isNewSubscriptionBulkBps(): Boolean = newSubscriptionBulkBps != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewSubscriptionBulk(): Boolean = newSubscriptionBulk != null + fun isBulk(): Boolean = bulk != null - fun isNewSubscriptionThresholdTotalAmount(): Boolean = - newSubscriptionThresholdTotalAmount != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewSubscriptionTieredPackage(): Boolean = newSubscriptionTieredPackage != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewSubscriptionTieredWithMinimum(): Boolean = - newSubscriptionTieredWithMinimum != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewSubscriptionUnitWithPercent(): Boolean = newSubscriptionUnitWithPercent != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewSubscriptionPackageWithAllocation(): Boolean = - newSubscriptionPackageWithAllocation != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewSubscriptionTierWithProration(): Boolean = - newSubscriptionTierWithProration != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewSubscriptionUnitWithProration(): Boolean = - newSubscriptionUnitWithProration != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewSubscriptionGroupedAllocation(): Boolean = - newSubscriptionGroupedAllocation != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewSubscriptionGroupedWithProratedMinimum(): Boolean = - newSubscriptionGroupedWithProratedMinimum != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewSubscriptionBulkWithProration(): Boolean = - newSubscriptionBulkWithProration != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewSubscriptionScalableMatrixWithUnitPricing(): Boolean = - newSubscriptionScalableMatrixWithUnitPricing != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewSubscriptionScalableMatrixWithTieredPricing(): Boolean = - newSubscriptionScalableMatrixWithTieredPricing != null + fun isScalableMatrixWithTieredPricing(): Boolean = + scalableMatrixWithTieredPricing != null - fun isNewSubscriptionCumulativeGroupedBulk(): Boolean = - newSubscriptionCumulativeGroupedBulk != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun isNewSubscriptionMaxGroupTieredPackage(): Boolean = - newSubscriptionMaxGroupTieredPackage != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewSubscriptionGroupedWithMeteredMinimum(): Boolean = - newSubscriptionGroupedWithMeteredMinimum != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewSubscriptionMatrixWithDisplayName(): Boolean = - newSubscriptionMatrixWithDisplayName != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewSubscriptionGroupedTieredPackage(): Boolean = - newSubscriptionGroupedTieredPackage != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun asNewSubscriptionUnit(): NewSubscriptionUnitPrice = - newSubscriptionUnit.getOrThrow("newSubscriptionUnit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewSubscriptionPackage(): NewSubscriptionPackagePrice = - newSubscriptionPackage.getOrThrow("newSubscriptionPackage") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewSubscriptionMatrix(): NewSubscriptionMatrixPrice = - newSubscriptionMatrix.getOrThrow("newSubscriptionMatrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewSubscriptionTiered(): NewSubscriptionTieredPrice = - newSubscriptionTiered.getOrThrow("newSubscriptionTiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewSubscriptionTieredBps(): NewSubscriptionTieredBpsPrice = - newSubscriptionTieredBps.getOrThrow("newSubscriptionTieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewSubscriptionBps(): NewSubscriptionBpsPrice = - newSubscriptionBps.getOrThrow("newSubscriptionBps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewSubscriptionBulkBps(): NewSubscriptionBulkBpsPrice = - newSubscriptionBulkBps.getOrThrow("newSubscriptionBulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewSubscriptionBulk(): NewSubscriptionBulkPrice = - newSubscriptionBulk.getOrThrow("newSubscriptionBulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewSubscriptionThresholdTotalAmount(): NewSubscriptionThresholdTotalAmountPrice = - newSubscriptionThresholdTotalAmount.getOrThrow( - "newSubscriptionThresholdTotalAmount" - ) + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewSubscriptionTieredPackage(): NewSubscriptionTieredPackagePrice = - newSubscriptionTieredPackage.getOrThrow("newSubscriptionTieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewSubscriptionTieredWithMinimum(): NewSubscriptionTieredWithMinimumPrice = - newSubscriptionTieredWithMinimum.getOrThrow("newSubscriptionTieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewSubscriptionUnitWithPercent(): NewSubscriptionUnitWithPercentPrice = - newSubscriptionUnitWithPercent.getOrThrow("newSubscriptionUnitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewSubscriptionPackageWithAllocation(): - NewSubscriptionPackageWithAllocationPrice = - newSubscriptionPackageWithAllocation.getOrThrow( - "newSubscriptionPackageWithAllocation" - ) + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewSubscriptionTierWithProration(): NewSubscriptionTierWithProrationPrice = - newSubscriptionTierWithProration.getOrThrow("newSubscriptionTierWithProration") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewSubscriptionUnitWithProration(): NewSubscriptionUnitWithProrationPrice = - newSubscriptionUnitWithProration.getOrThrow("newSubscriptionUnitWithProration") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewSubscriptionGroupedAllocation(): NewSubscriptionGroupedAllocationPrice = - newSubscriptionGroupedAllocation.getOrThrow("newSubscriptionGroupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewSubscriptionGroupedWithProratedMinimum(): - NewSubscriptionGroupedWithProratedMinimumPrice = - newSubscriptionGroupedWithProratedMinimum.getOrThrow( - "newSubscriptionGroupedWithProratedMinimum" - ) + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewSubscriptionBulkWithProration(): NewSubscriptionBulkWithProrationPrice = - newSubscriptionBulkWithProration.getOrThrow("newSubscriptionBulkWithProration") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewSubscriptionScalableMatrixWithUnitPricing(): - NewSubscriptionScalableMatrixWithUnitPricingPrice = - newSubscriptionScalableMatrixWithUnitPricing.getOrThrow( - "newSubscriptionScalableMatrixWithUnitPricing" - ) + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewSubscriptionScalableMatrixWithTieredPricing(): - NewSubscriptionScalableMatrixWithTieredPricingPrice = - newSubscriptionScalableMatrixWithTieredPricing.getOrThrow( - "newSubscriptionScalableMatrixWithTieredPricing" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewSubscriptionCumulativeGroupedBulk(): - NewSubscriptionCumulativeGroupedBulkPrice = - newSubscriptionCumulativeGroupedBulk.getOrThrow( - "newSubscriptionCumulativeGroupedBulk" - ) + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") - fun asNewSubscriptionMaxGroupTieredPackage(): - NewSubscriptionMaxGroupTieredPackagePrice = - newSubscriptionMaxGroupTieredPackage.getOrThrow( - "newSubscriptionMaxGroupTieredPackage" - ) + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewSubscriptionGroupedWithMeteredMinimum(): - NewSubscriptionGroupedWithMeteredMinimumPrice = - newSubscriptionGroupedWithMeteredMinimum.getOrThrow( - "newSubscriptionGroupedWithMeteredMinimum" - ) + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewSubscriptionMatrixWithDisplayName(): - NewSubscriptionMatrixWithDisplayNamePrice = - newSubscriptionMatrixWithDisplayName.getOrThrow( - "newSubscriptionMatrixWithDisplayName" - ) + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewSubscriptionGroupedTieredPackage(): NewSubscriptionGroupedTieredPackagePrice = - newSubscriptionGroupedTieredPackage.getOrThrow( - "newSubscriptionGroupedTieredPackage" - ) + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newSubscriptionUnit != null -> - visitor.visitNewSubscriptionUnit(newSubscriptionUnit) - newSubscriptionPackage != null -> - visitor.visitNewSubscriptionPackage(newSubscriptionPackage) - newSubscriptionMatrix != null -> - visitor.visitNewSubscriptionMatrix(newSubscriptionMatrix) - newSubscriptionTiered != null -> - visitor.visitNewSubscriptionTiered(newSubscriptionTiered) - newSubscriptionTieredBps != null -> - visitor.visitNewSubscriptionTieredBps(newSubscriptionTieredBps) - newSubscriptionBps != null -> - visitor.visitNewSubscriptionBps(newSubscriptionBps) - newSubscriptionBulkBps != null -> - visitor.visitNewSubscriptionBulkBps(newSubscriptionBulkBps) - newSubscriptionBulk != null -> - visitor.visitNewSubscriptionBulk(newSubscriptionBulk) - newSubscriptionThresholdTotalAmount != null -> - visitor.visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount - ) - newSubscriptionTieredPackage != null -> - visitor.visitNewSubscriptionTieredPackage(newSubscriptionTieredPackage) - newSubscriptionTieredWithMinimum != null -> - visitor.visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum - ) - newSubscriptionUnitWithPercent != null -> - visitor.visitNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent) - newSubscriptionPackageWithAllocation != null -> - visitor.visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - newSubscriptionTierWithProration != null -> - visitor.visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration - ) - newSubscriptionUnitWithProration != null -> - visitor.visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration - ) - newSubscriptionGroupedAllocation != null -> - visitor.visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation - ) - newSubscriptionGroupedWithProratedMinimum != null -> - visitor.visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - newSubscriptionBulkWithProration != null -> - visitor.visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration - ) - newSubscriptionScalableMatrixWithUnitPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - newSubscriptionScalableMatrixWithTieredPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - newSubscriptionCumulativeGroupedBulk != null -> - visitor.visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - newSubscriptionMaxGroupTieredPackage != null -> - visitor.visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - newSubscriptionGroupedWithMeteredMinimum != null -> - visitor.visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - newSubscriptionMatrixWithDisplayName != null -> - visitor.visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - newSubscriptionGroupedTieredPackage != null -> - visitor.visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredWithProration != null -> + visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing ) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) else -> visitor.unknown(_json) } @@ -7814,164 +7538,126 @@ private constructor( accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) { - newSubscriptionUnit.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) { - newSubscriptionPackage.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) { - newSubscriptionMatrix.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) { - newSubscriptionTiered.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) { - newSubscriptionTieredBps.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) { - newSubscriptionBps.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) { - newSubscriptionBulkBps.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) { - newSubscriptionBulk.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newSubscriptionThresholdTotalAmount.validate() + thresholdTotalAmount.validate() } - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) { - newSubscriptionTieredPackage.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) { - newSubscriptionTieredWithMinimum.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) { - newSubscriptionUnitWithPercent.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newSubscriptionPackageWithAllocation.validate() + packageWithAllocation.validate() } - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newSubscriptionTierWithProration.validate() + tieredWithProration.validate() } - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) { - newSubscriptionUnitWithProration.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) { - newSubscriptionGroupedAllocation.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newSubscriptionGroupedWithProratedMinimum.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) { - newSubscriptionBulkWithProration.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newSubscriptionScalableMatrixWithUnitPricing.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newSubscriptionScalableMatrixWithTieredPricing.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newSubscriptionCumulativeGroupedBulk.validate() + cumulativeGroupedBulk.validate() } - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newSubscriptionMaxGroupTieredPackage.validate() + maxGroupTieredPackage.validate() } - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newSubscriptionGroupedWithMeteredMinimum.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newSubscriptionMatrixWithDisplayName.validate() + matrixWithDisplayName.validate() } - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newSubscriptionGroupedTieredPackage.validate() + groupedTieredPackage.validate() } } ) @@ -7996,115 +7682,83 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) = newSubscriptionUnit.validity() - - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) = newSubscriptionPackage.validity() - - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) = newSubscriptionMatrix.validity() - - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) = newSubscriptionTiered.validity() - - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = newSubscriptionTieredBps.validity() - - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) = newSubscriptionBps.validity() - - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) = newSubscriptionBulkBps.validity() - - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) = newSubscriptionBulk.validity() - - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice - ) = newSubscriptionThresholdTotalAmount.validity() - - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = newSubscriptionTieredPackage.validity() - - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = newSubscriptionTieredWithMinimum.validity() - - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = newSubscriptionUnitWithPercent.validity() - - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice - ) = newSubscriptionPackageWithAllocation.validity() - - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = newSubscriptionTierWithProration.validity() - - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = newSubscriptionUnitWithProration.validity() - - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = newSubscriptionGroupedAllocation.validity() - - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = newSubscriptionGroupedWithProratedMinimum.validity() - - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = newSubscriptionBulkWithProration.validity() - - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = newSubscriptionScalableMatrixWithUnitPricing.validity() - - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = newSubscriptionScalableMatrixWithTieredPricing.validity() - - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice - ) = newSubscriptionCumulativeGroupedBulk.validity() - - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice - ) = newSubscriptionMaxGroupTieredPackage.validity() - - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = newSubscriptionGroupedWithMeteredMinimum.validity() - - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice - ) = newSubscriptionMatrixWithDisplayName.validity() - - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice - ) = newSubscriptionGroupedTieredPackage.validity() + override fun visitUnit(unit: Unit) = unit.validity() + + override fun visitPackage(package_: Package) = package_.validity() + + override fun visitMatrix(matrix: Matrix) = matrix.validity() + + override fun visitTiered(tiered: Tiered) = tiered.validity() + + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() + + override fun visitBps(bps: Bps) = bps.validity() + + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() + + override fun visitBulk(bulk: Bulk) = bulk.validity() + + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() + + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() + + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() + + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() + + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() + + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() + + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() + + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() + + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() + + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() + + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() + + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() + + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() + + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() + + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() + + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() + + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -8115,215 +7769,141 @@ private constructor( return true } - return /* spotless:off */ other is Price && newSubscriptionUnit == other.newSubscriptionUnit && newSubscriptionPackage == other.newSubscriptionPackage && newSubscriptionMatrix == other.newSubscriptionMatrix && newSubscriptionTiered == other.newSubscriptionTiered && newSubscriptionTieredBps == other.newSubscriptionTieredBps && newSubscriptionBps == other.newSubscriptionBps && newSubscriptionBulkBps == other.newSubscriptionBulkBps && newSubscriptionBulk == other.newSubscriptionBulk && newSubscriptionThresholdTotalAmount == other.newSubscriptionThresholdTotalAmount && newSubscriptionTieredPackage == other.newSubscriptionTieredPackage && newSubscriptionTieredWithMinimum == other.newSubscriptionTieredWithMinimum && newSubscriptionUnitWithPercent == other.newSubscriptionUnitWithPercent && newSubscriptionPackageWithAllocation == other.newSubscriptionPackageWithAllocation && newSubscriptionTierWithProration == other.newSubscriptionTierWithProration && newSubscriptionUnitWithProration == other.newSubscriptionUnitWithProration && newSubscriptionGroupedAllocation == other.newSubscriptionGroupedAllocation && newSubscriptionGroupedWithProratedMinimum == other.newSubscriptionGroupedWithProratedMinimum && newSubscriptionBulkWithProration == other.newSubscriptionBulkWithProration && newSubscriptionScalableMatrixWithUnitPricing == other.newSubscriptionScalableMatrixWithUnitPricing && newSubscriptionScalableMatrixWithTieredPricing == other.newSubscriptionScalableMatrixWithTieredPricing && newSubscriptionCumulativeGroupedBulk == other.newSubscriptionCumulativeGroupedBulk && newSubscriptionMaxGroupTieredPackage == other.newSubscriptionMaxGroupTieredPackage && newSubscriptionGroupedWithMeteredMinimum == other.newSubscriptionGroupedWithMeteredMinimum && newSubscriptionMatrixWithDisplayName == other.newSubscriptionMatrixWithDisplayName && newSubscriptionGroupedTieredPackage == other.newSubscriptionGroupedTieredPackage /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && bulkWithProration == other.bulkWithProration && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk && maxGroupTieredPackage == other.maxGroupTieredPackage && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && groupedTieredPackage == other.groupedTieredPackage /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newSubscriptionUnit, newSubscriptionPackage, newSubscriptionMatrix, newSubscriptionTiered, newSubscriptionTieredBps, newSubscriptionBps, newSubscriptionBulkBps, newSubscriptionBulk, newSubscriptionThresholdTotalAmount, newSubscriptionTieredPackage, newSubscriptionTieredWithMinimum, newSubscriptionUnitWithPercent, newSubscriptionPackageWithAllocation, newSubscriptionTierWithProration, newSubscriptionUnitWithProration, newSubscriptionGroupedAllocation, newSubscriptionGroupedWithProratedMinimum, newSubscriptionBulkWithProration, newSubscriptionScalableMatrixWithUnitPricing, newSubscriptionScalableMatrixWithTieredPricing, newSubscriptionCumulativeGroupedBulk, newSubscriptionMaxGroupTieredPackage, newSubscriptionGroupedWithMeteredMinimum, newSubscriptionMatrixWithDisplayName, newSubscriptionGroupedTieredPackage) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, bulkWithProration, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk, maxGroupTieredPackage, groupedWithMeteredMinimum, matrixWithDisplayName, groupedTieredPackage) /* spotless:on */ override fun toString(): String = when { - newSubscriptionUnit != null -> "Price{newSubscriptionUnit=$newSubscriptionUnit}" - newSubscriptionPackage != null -> - "Price{newSubscriptionPackage=$newSubscriptionPackage}" - newSubscriptionMatrix != null -> - "Price{newSubscriptionMatrix=$newSubscriptionMatrix}" - newSubscriptionTiered != null -> - "Price{newSubscriptionTiered=$newSubscriptionTiered}" - newSubscriptionTieredBps != null -> - "Price{newSubscriptionTieredBps=$newSubscriptionTieredBps}" - newSubscriptionBps != null -> "Price{newSubscriptionBps=$newSubscriptionBps}" - newSubscriptionBulkBps != null -> - "Price{newSubscriptionBulkBps=$newSubscriptionBulkBps}" - newSubscriptionBulk != null -> "Price{newSubscriptionBulk=$newSubscriptionBulk}" - newSubscriptionThresholdTotalAmount != null -> - "Price{newSubscriptionThresholdTotalAmount=$newSubscriptionThresholdTotalAmount}" - newSubscriptionTieredPackage != null -> - "Price{newSubscriptionTieredPackage=$newSubscriptionTieredPackage}" - newSubscriptionTieredWithMinimum != null -> - "Price{newSubscriptionTieredWithMinimum=$newSubscriptionTieredWithMinimum}" - newSubscriptionUnitWithPercent != null -> - "Price{newSubscriptionUnitWithPercent=$newSubscriptionUnitWithPercent}" - newSubscriptionPackageWithAllocation != null -> - "Price{newSubscriptionPackageWithAllocation=$newSubscriptionPackageWithAllocation}" - newSubscriptionTierWithProration != null -> - "Price{newSubscriptionTierWithProration=$newSubscriptionTierWithProration}" - newSubscriptionUnitWithProration != null -> - "Price{newSubscriptionUnitWithProration=$newSubscriptionUnitWithProration}" - newSubscriptionGroupedAllocation != null -> - "Price{newSubscriptionGroupedAllocation=$newSubscriptionGroupedAllocation}" - newSubscriptionGroupedWithProratedMinimum != null -> - "Price{newSubscriptionGroupedWithProratedMinimum=$newSubscriptionGroupedWithProratedMinimum}" - newSubscriptionBulkWithProration != null -> - "Price{newSubscriptionBulkWithProration=$newSubscriptionBulkWithProration}" - newSubscriptionScalableMatrixWithUnitPricing != null -> - "Price{newSubscriptionScalableMatrixWithUnitPricing=$newSubscriptionScalableMatrixWithUnitPricing}" - newSubscriptionScalableMatrixWithTieredPricing != null -> - "Price{newSubscriptionScalableMatrixWithTieredPricing=$newSubscriptionScalableMatrixWithTieredPricing}" - newSubscriptionCumulativeGroupedBulk != null -> - "Price{newSubscriptionCumulativeGroupedBulk=$newSubscriptionCumulativeGroupedBulk}" - newSubscriptionMaxGroupTieredPackage != null -> - "Price{newSubscriptionMaxGroupTieredPackage=$newSubscriptionMaxGroupTieredPackage}" - newSubscriptionGroupedWithMeteredMinimum != null -> - "Price{newSubscriptionGroupedWithMeteredMinimum=$newSubscriptionGroupedWithMeteredMinimum}" - newSubscriptionMatrixWithDisplayName != null -> - "Price{newSubscriptionMatrixWithDisplayName=$newSubscriptionMatrixWithDisplayName}" - newSubscriptionGroupedTieredPackage != null -> - "Price{newSubscriptionGroupedTieredPackage=$newSubscriptionGroupedTieredPackage}" + unit != null -> "Price{unit=$unit}" + package_ != null -> "Price{package_=$package_}" + matrix != null -> "Price{matrix=$matrix}" + tiered != null -> "Price{tiered=$tiered}" + tieredBps != null -> "Price{tieredBps=$tieredBps}" + bps != null -> "Price{bps=$bps}" + bulkBps != null -> "Price{bulkBps=$bulkBps}" + bulk != null -> "Price{bulk=$bulk}" + thresholdTotalAmount != null -> + "Price{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" + tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" + unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" + packageWithAllocation != null -> + "Price{packageWithAllocation=$packageWithAllocation}" + tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" + scalableMatrixWithUnitPricing != null -> + "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" + maxGroupTieredPackage != null -> + "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" + groupedWithMeteredMinimum != null -> + "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Price{matrixWithDisplayName=$matrixWithDisplayName}" + groupedTieredPackage != null -> + "Price{groupedTieredPackage=$groupedTieredPackage}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } companion object { - @JvmStatic - fun ofNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice) = - Price(newSubscriptionUnit = newSubscriptionUnit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofNewSubscriptionPackage(newSubscriptionPackage: NewSubscriptionPackagePrice) = - Price(newSubscriptionPackage = newSubscriptionPackage) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic - fun ofNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice) = - Price(newSubscriptionMatrix = newSubscriptionMatrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) - @JvmStatic - fun ofNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice) = - Price(newSubscriptionTiered = newSubscriptionTiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic - fun ofNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = Price(newSubscriptionTieredBps = newSubscriptionTieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic - fun ofNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice) = - Price(newSubscriptionBps = newSubscriptionBps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic - fun ofNewSubscriptionBulkBps(newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice) = - Price(newSubscriptionBulkBps = newSubscriptionBulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic - fun ofNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice) = - Price(newSubscriptionBulk = newSubscriptionBulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ) = Price(newSubscriptionThresholdTotalAmount = newSubscriptionThresholdTotalAmount) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = Price(newSubscriptionTieredPackage = newSubscriptionTieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = + Price(tieredPackage = tieredPackage) @JvmStatic - fun ofNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = Price(newSubscriptionTieredWithMinimum = newSubscriptionTieredWithMinimum) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = Price(newSubscriptionUnitWithPercent = newSubscriptionUnitWithPercent) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ) = - Price( - newSubscriptionPackageWithAllocation = newSubscriptionPackageWithAllocation - ) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = Price(newSubscriptionTierWithProration = newSubscriptionTierWithProration) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = Price(newSubscriptionUnitWithProration = newSubscriptionUnitWithProration) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Price(unitWithProration = unitWithProration) @JvmStatic - fun ofNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = Price(newSubscriptionGroupedAllocation = newSubscriptionGroupedAllocation) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = - Price( - newSubscriptionGroupedWithProratedMinimum = - newSubscriptionGroupedWithProratedMinimum - ) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = Price(newSubscriptionBulkWithProration = newSubscriptionBulkWithProration) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithUnitPricing = - newSubscriptionScalableMatrixWithUnitPricing - ) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithTieredPricing = - newSubscriptionScalableMatrixWithTieredPricing - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ) = - Price( - newSubscriptionCumulativeGroupedBulk = newSubscriptionCumulativeGroupedBulk - ) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Price(cumulativeGroupedBulk = cumulativeGroupedBulk) @JvmStatic - fun ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ) = - Price( - newSubscriptionMaxGroupTieredPackage = newSubscriptionMaxGroupTieredPackage - ) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - Price( - newSubscriptionGroupedWithMeteredMinimum = - newSubscriptionGroupedWithMeteredMinimum - ) + fun ofGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ) = - Price( - newSubscriptionMatrixWithDisplayName = newSubscriptionMatrixWithDisplayName - ) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ) = Price(newSubscriptionGroupedTieredPackage = newSubscriptionGroupedTieredPackage) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Price(groupedTieredPackage = groupedTieredPackage) } /** @@ -8331,99 +7911,63 @@ private constructor( */ interface Visitor { - fun visitNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ): T + fun visitPackage(package_: Package): T - fun visitNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T - fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -8449,221 +7993,138 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionUnit = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unit = it, _json = json) + } ?: Price(_json = json) } "package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) + } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionMatrix = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrix = it, _json = json) + } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTiered = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tiered = it, _json = json) + } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredBps = it, _json = json) + } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bps = it, _json = json) + } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkBps = it, _json = json) + } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBulk = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulk = it, _json = json) + } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionThresholdTotalAmount = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(thresholdTotalAmount = it, _json = json) } + ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackage = it, _json = json) + } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithMinimum = it, _json = json) + } ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithPercent = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithPercent = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionPackageWithAllocation = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(packageWithAllocation = it, _json = json) } + ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTierWithProration = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(tieredWithProration = it, _json = json) } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionGroupedAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedAllocation = it, _json = json) + } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionGroupedWithProratedMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(groupedWithProratedMinimum = it, _json = json) } + ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkWithProration = it, _json = json) + } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithUnitPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithUnitPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } + ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithTieredPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithTieredPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionCumulativeGroupedBulk = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(cumulativeGroupedBulk = it, _json = json) } + ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMaxGroupTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(maxGroupTieredPackage = it, _json = json) } + ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price( - newSubscriptionGroupedWithMeteredMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } + ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMatrixWithDisplayName = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(matrixWithDisplayName = it, _json = json) } + ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionGroupedTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedTieredPackage = it, _json = json) } + ?: Price(_json = json) } } @@ -8679,67 +8140,54 @@ private constructor( provider: SerializerProvider, ) { when { - value.newSubscriptionUnit != null -> - generator.writeObject(value.newSubscriptionUnit) - value.newSubscriptionPackage != null -> - generator.writeObject(value.newSubscriptionPackage) - value.newSubscriptionMatrix != null -> - generator.writeObject(value.newSubscriptionMatrix) - value.newSubscriptionTiered != null -> - generator.writeObject(value.newSubscriptionTiered) - value.newSubscriptionTieredBps != null -> - generator.writeObject(value.newSubscriptionTieredBps) - value.newSubscriptionBps != null -> - generator.writeObject(value.newSubscriptionBps) - value.newSubscriptionBulkBps != null -> - generator.writeObject(value.newSubscriptionBulkBps) - value.newSubscriptionBulk != null -> - generator.writeObject(value.newSubscriptionBulk) - value.newSubscriptionThresholdTotalAmount != null -> - generator.writeObject(value.newSubscriptionThresholdTotalAmount) - value.newSubscriptionTieredPackage != null -> - generator.writeObject(value.newSubscriptionTieredPackage) - value.newSubscriptionTieredWithMinimum != null -> - generator.writeObject(value.newSubscriptionTieredWithMinimum) - value.newSubscriptionUnitWithPercent != null -> - generator.writeObject(value.newSubscriptionUnitWithPercent) - value.newSubscriptionPackageWithAllocation != null -> - generator.writeObject(value.newSubscriptionPackageWithAllocation) - value.newSubscriptionTierWithProration != null -> - generator.writeObject(value.newSubscriptionTierWithProration) - value.newSubscriptionUnitWithProration != null -> - generator.writeObject(value.newSubscriptionUnitWithProration) - value.newSubscriptionGroupedAllocation != null -> - generator.writeObject(value.newSubscriptionGroupedAllocation) - value.newSubscriptionGroupedWithProratedMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithProratedMinimum) - value.newSubscriptionBulkWithProration != null -> - generator.writeObject(value.newSubscriptionBulkWithProration) - value.newSubscriptionScalableMatrixWithUnitPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithUnitPricing - ) - value.newSubscriptionScalableMatrixWithTieredPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithTieredPricing - ) - value.newSubscriptionCumulativeGroupedBulk != null -> - generator.writeObject(value.newSubscriptionCumulativeGroupedBulk) - value.newSubscriptionMaxGroupTieredPackage != null -> - generator.writeObject(value.newSubscriptionMaxGroupTieredPackage) - value.newSubscriptionGroupedWithMeteredMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithMeteredMinimum) - value.newSubscriptionMatrixWithDisplayName != null -> - generator.writeObject(value.newSubscriptionMatrixWithDisplayName) - value.newSubscriptionGroupedTieredPackage != null -> - generator.writeObject(value.newSubscriptionGroupedTieredPackage) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.unitWithPercent != null -> + generator.writeObject(value.unitWithPercent) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } } } - class NewSubscriptionUnitPrice + class Unit private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -9145,8 +8593,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -9159,7 +8606,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -9184,27 +8631,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - cadence = newSubscriptionUnitPrice.cadence - itemId = newSubscriptionUnitPrice.itemId - modelType = newSubscriptionUnitPrice.modelType - name = newSubscriptionUnitPrice.name - unitConfig = newSubscriptionUnitPrice.unitConfig - billableMetricId = newSubscriptionUnitPrice.billableMetricId - billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitPrice.conversionRate - 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() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + currency = unit.currency + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + referenceId = unit.referenceId + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -9577,7 +9021,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -9591,8 +9035,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitPrice = - NewSubscriptionUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -9615,7 +9059,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -10844,7 +10288,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -10854,10 +10298,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewSubscriptionPackagePrice + class Package private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -11263,8 +10707,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -11277,7 +10720,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -11302,29 +10745,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = - apply { - cadence = newSubscriptionPackagePrice.cadence - itemId = newSubscriptionPackagePrice.itemId - modelType = newSubscriptionPackagePrice.modelType - name = newSubscriptionPackagePrice.name - packageConfig = newSubscriptionPackagePrice.packageConfig - billableMetricId = newSubscriptionPackagePrice.billableMetricId - billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionPackagePrice.conversionRate - 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() - } + internal fun from(package_: Package) = apply { + cadence = package_.cadence + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + currency = package_.currency + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + referenceId = package_.referenceId + additionalProperties = package_.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -11697,7 +11136,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -11711,8 +11150,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackagePrice = - NewSubscriptionPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -11735,7 +11174,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -13015,7 +12454,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -13025,10 +12464,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewSubscriptionMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -13434,8 +12873,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -13448,7 +12886,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -13473,29 +12911,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = - apply { - cadence = newSubscriptionMatrixPrice.cadence - itemId = newSubscriptionMatrixPrice.itemId - matrixConfig = newSubscriptionMatrixPrice.matrixConfig - modelType = newSubscriptionMatrixPrice.modelType - name = newSubscriptionMatrixPrice.name - billableMetricId = newSubscriptionMatrixPrice.billableMetricId - billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixPrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixPrice.conversionRate - 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() - } + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + currency = matrix.currency + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + referenceId = matrix.referenceId + additionalProperties = matrix.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -13868,7 +13302,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -13882,8 +13316,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixPrice = - NewSubscriptionMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), @@ -13906,7 +13340,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -15509,7 +14943,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -15519,10 +14953,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewSubscriptionTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -15928,8 +15362,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -15942,7 +15375,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -15967,29 +15400,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = - apply { - cadence = newSubscriptionTieredPrice.cadence - itemId = newSubscriptionTieredPrice.itemId - modelType = newSubscriptionTieredPrice.modelType - name = newSubscriptionTieredPrice.name - tieredConfig = newSubscriptionTieredPrice.tieredConfig - billableMetricId = newSubscriptionTieredPrice.billableMetricId - billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPrice.conversionRate - 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() - } + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + currency = tiered.currency + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + referenceId = tiered.referenceId + additionalProperties = tiered.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -16362,7 +15791,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -16376,8 +15805,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPrice = - NewSubscriptionTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -16400,7 +15829,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -17921,7 +17350,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -17931,10 +17360,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewSubscriptionTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -18341,8 +17770,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -18355,7 +17783,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -18380,29 +17808,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice - ) = apply { - cadence = newSubscriptionTieredBpsPrice.cadence - itemId = newSubscriptionTieredBpsPrice.itemId - modelType = newSubscriptionTieredBpsPrice.modelType - name = newSubscriptionTieredBpsPrice.name - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig - billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredBpsPrice.conversionRate - 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() + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + currency = tieredBps.currency + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + referenceId = tieredBps.referenceId + additionalProperties = tieredBps.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -18776,7 +18199,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -18790,8 +18213,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredBpsPrice = - NewSubscriptionTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -18814,7 +18237,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -20377,7 +19800,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -20387,10 +19810,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewSubscriptionBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -20796,8 +20219,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -20810,7 +20232,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -20835,27 +20257,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - bpsConfig = newSubscriptionBpsPrice.bpsConfig - cadence = newSubscriptionBpsPrice.cadence - itemId = newSubscriptionBpsPrice.itemId - modelType = newSubscriptionBpsPrice.modelType - name = newSubscriptionBpsPrice.name - billableMetricId = newSubscriptionBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBpsPrice.conversionRate - 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() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + currency = bps.currency + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + referenceId = bps.referenceId + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -21228,7 +20647,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -21242,8 +20661,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBpsPrice = - NewSubscriptionBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -21266,7 +20685,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -22542,7 +21961,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -22552,10 +21971,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewSubscriptionBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -22961,8 +22380,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -22975,7 +22393,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -23000,29 +22418,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = - apply { - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig - cadence = newSubscriptionBulkBpsPrice.cadence - itemId = newSubscriptionBulkBpsPrice.itemId - modelType = newSubscriptionBulkBpsPrice.modelType - name = newSubscriptionBulkBpsPrice.name - billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkBpsPrice.conversionRate - 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() - } + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + currency = bulkBps.currency + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + referenceId = bulkBps.referenceId + additionalProperties = bulkBps.additionalProperties.toMutableMap() + } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = bulkBpsConfig(JsonField.of(bulkBpsConfig)) @@ -23395,7 +22809,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -23409,8 +22823,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkBpsPrice = - NewSubscriptionBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -23433,7 +22847,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -24950,7 +24364,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -24960,10 +24374,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewSubscriptionBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -25369,8 +24783,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -25383,7 +24796,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -25408,27 +24821,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - bulkConfig = newSubscriptionBulkPrice.bulkConfig - cadence = newSubscriptionBulkPrice.cadence - itemId = newSubscriptionBulkPrice.itemId - modelType = newSubscriptionBulkPrice.modelType - name = newSubscriptionBulkPrice.name - billableMetricId = newSubscriptionBulkPrice.billableMetricId - billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkPrice.conversionRate - 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() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + currency = bulk.currency + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + referenceId = bulk.referenceId + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -25801,7 +25211,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -25815,8 +25225,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkPrice = - NewSubscriptionBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -25839,7 +25249,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -27314,7 +26724,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -27324,10 +26734,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewSubscriptionThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -27737,7 +27147,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionThresholdTotalAmountPrice]. + * [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -27750,7 +27160,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -27776,34 +27186,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionThresholdTotalAmountPrice: - NewSubscriptionThresholdTotalAmountPrice - ) = apply { - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - itemId = newSubscriptionThresholdTotalAmountPrice.itemId - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - name = newSubscriptionThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - currency = newSubscriptionThresholdTotalAmountPrice.currency - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + currency = thresholdTotalAmount.currency + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId + thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata + referenceId = thresholdTotalAmount.referenceId additionalProperties = - newSubscriptionThresholdTotalAmountPrice.additionalProperties - .toMutableMap() + thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -28179,7 +27581,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -28193,8 +27595,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionThresholdTotalAmountPrice = - NewSubscriptionThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -28217,7 +27619,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -29391,7 +28793,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -29401,10 +28803,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewSubscriptionTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -29811,8 +29213,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -29825,7 +29226,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -29850,29 +29251,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice - ) = apply { - cadence = newSubscriptionTieredPackagePrice.cadence - itemId = newSubscriptionTieredPackagePrice.itemId - modelType = newSubscriptionTieredPackagePrice.modelType - name = newSubscriptionTieredPackagePrice.name - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig - billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPackagePrice.conversionRate - 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() + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + currency = tieredPackage.currency + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + referenceId = tieredPackage.referenceId + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -30247,7 +29643,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -30261,8 +29657,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPackagePrice = - NewSubscriptionTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -30285,7 +29681,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -31456,7 +30852,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -31466,10 +30862,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewSubscriptionTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -31878,7 +31274,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredWithMinimumPrice]. + * [TieredWithMinimum]. * * The following fields are required: * ```java @@ -31891,7 +31287,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -31916,33 +31312,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice - ) = apply { - cadence = newSubscriptionTieredWithMinimumPrice.cadence - itemId = newSubscriptionTieredWithMinimumPrice.itemId - modelType = newSubscriptionTieredWithMinimumPrice.modelType - name = newSubscriptionTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - currency = newSubscriptionTieredWithMinimumPrice.currency - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newSubscriptionTieredWithMinimumPrice.metadata - referenceId = newSubscriptionTieredWithMinimumPrice.referenceId - additionalProperties = - newSubscriptionTieredWithMinimumPrice.additionalProperties - .toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + currency = tieredWithMinimum.currency + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + referenceId = tieredWithMinimum.referenceId + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -32316,7 +31703,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -32330,8 +31717,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredWithMinimumPrice = - NewSubscriptionTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -32354,7 +31741,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -33528,7 +32915,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -33538,10 +32925,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewSubscriptionUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -33949,8 +33336,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -33963,7 +33349,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -33988,30 +33374,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice - ) = apply { - cadence = newSubscriptionUnitWithPercentPrice.cadence - itemId = newSubscriptionUnitWithPercentPrice.itemId - modelType = newSubscriptionUnitWithPercentPrice.modelType - name = newSubscriptionUnitWithPercentPrice.name - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig - billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - 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() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + currency = unitWithPercent.currency + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + referenceId = unitWithPercent.referenceId + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -34385,7 +33765,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -34399,8 +33779,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithPercentPrice = - NewSubscriptionUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -34423,7 +33803,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -35594,7 +34974,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -35604,10 +34984,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewSubscriptionPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -36017,7 +35397,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -36030,7 +35410,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -36057,35 +35437,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionPackageWithAllocationPrice: - NewSubscriptionPackageWithAllocationPrice - ) = apply { - cadence = newSubscriptionPackageWithAllocationPrice.cadence - itemId = newSubscriptionPackageWithAllocationPrice.itemId - modelType = newSubscriptionPackageWithAllocationPrice.modelType - name = newSubscriptionPackageWithAllocationPrice.name + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = - newSubscriptionPackageWithAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - currency = newSubscriptionPackageWithAllocationPrice.currency - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey + packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + currency = packageWithAllocation.currency + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionPackageWithAllocationPrice.metadata - referenceId = newSubscriptionPackageWithAllocationPrice.referenceId + packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata + referenceId = packageWithAllocation.referenceId additionalProperties = - newSubscriptionPackageWithAllocationPrice.additionalProperties - .toMutableMap() + packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -36461,7 +35833,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -36475,8 +35847,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackageWithAllocationPrice = - NewSubscriptionPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -36502,7 +35874,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -37677,7 +37049,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -37687,10 +37059,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewSubscriptionTierWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -38100,7 +37472,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTierWithProrationPrice]. + * [TieredWithProration]. * * The following fields are required: * ```java @@ -38113,7 +37485,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTierWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -38139,33 +37511,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice - ) = apply { - cadence = newSubscriptionTierWithProrationPrice.cadence - itemId = newSubscriptionTierWithProrationPrice.itemId - modelType = newSubscriptionTierWithProrationPrice.modelType - name = newSubscriptionTierWithProrationPrice.name - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - currency = newSubscriptionTierWithProrationPrice.currency - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTierWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTierWithProrationPrice.invoiceGroupingKey + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + currency = tieredWithProration.currency + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionTierWithProrationPrice.metadata - referenceId = newSubscriptionTierWithProrationPrice.referenceId + tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata + referenceId = tieredWithProration.referenceId additionalProperties = - newSubscriptionTierWithProrationPrice.additionalProperties - .toMutableMap() + tieredWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -38540,7 +37905,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTierWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -38554,8 +37919,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTierWithProrationPrice = - NewSubscriptionTierWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -38578,7 +37943,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTierWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -39752,7 +39117,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -39762,10 +39127,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewSubscriptionUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -40174,7 +39539,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithProrationPrice]. + * [UnitWithProration]. * * The following fields are required: * ```java @@ -40187,7 +39552,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -40212,33 +39577,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice - ) = apply { - cadence = newSubscriptionUnitWithProrationPrice.cadence - itemId = newSubscriptionUnitWithProrationPrice.itemId - modelType = newSubscriptionUnitWithProrationPrice.modelType - name = newSubscriptionUnitWithProrationPrice.name - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - currency = newSubscriptionUnitWithProrationPrice.currency - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionUnitWithProrationPrice.metadata - referenceId = newSubscriptionUnitWithProrationPrice.referenceId - additionalProperties = - newSubscriptionUnitWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + currency = unitWithProration.currency + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + referenceId = unitWithProration.referenceId + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -40612,7 +39968,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -40626,8 +39982,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithProrationPrice = - NewSubscriptionUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -40650,7 +40006,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -41824,7 +41180,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -41834,10 +41190,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewSubscriptionGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, @@ -42246,7 +41602,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedAllocationPrice]. + * [GroupedAllocation]. * * The following fields are required: * ```java @@ -42259,7 +41615,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -42284,33 +41640,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice - ) = apply { - cadence = newSubscriptionGroupedAllocationPrice.cadence - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - itemId = newSubscriptionGroupedAllocationPrice.itemId - modelType = newSubscriptionGroupedAllocationPrice.modelType - name = newSubscriptionGroupedAllocationPrice.name - billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - currency = newSubscriptionGroupedAllocationPrice.currency - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedAllocationPrice.metadata - referenceId = newSubscriptionGroupedAllocationPrice.referenceId - additionalProperties = - newSubscriptionGroupedAllocationPrice.additionalProperties - .toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + currency = groupedAllocation.currency + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + referenceId = groupedAllocation.referenceId + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -42684,7 +42031,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -42698,8 +42045,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedAllocationPrice = - NewSubscriptionGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), @@ -42722,7 +42069,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -43894,7 +43241,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -43904,10 +43251,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewSubscriptionGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val groupedWithProratedMinimumConfig: @@ -44320,7 +43667,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -44333,7 +43680,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -44361,41 +43708,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithProratedMinimumPrice: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - name = newSubscriptionGroupedWithProratedMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = + apply { + cadence = groupedWithProratedMinimum.cadence + groupedWithProratedMinimumConfig = + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + currency = groupedWithProratedMinimum.currency + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata + referenceId = groupedWithProratedMinimum.referenceId + additionalProperties = + groupedWithProratedMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -44776,8 +44112,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -44791,8 +44126,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = - NewSubscriptionGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", @@ -44818,7 +44153,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -45993,7 +45328,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -46003,10 +45338,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewSubscriptionBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -46415,7 +45750,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkWithProrationPrice]. + * [BulkWithProration]. * * The following fields are required: * ```java @@ -46428,7 +45763,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -46453,33 +45788,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice - ) = apply { - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - cadence = newSubscriptionBulkWithProrationPrice.cadence - itemId = newSubscriptionBulkWithProrationPrice.itemId - modelType = newSubscriptionBulkWithProrationPrice.modelType - name = newSubscriptionBulkWithProrationPrice.name - billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - currency = newSubscriptionBulkWithProrationPrice.currency - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionBulkWithProrationPrice.metadata - referenceId = newSubscriptionBulkWithProrationPrice.referenceId - additionalProperties = - newSubscriptionBulkWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + currency = bulkWithProration.currency + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + referenceId = bulkWithProration.referenceId + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = @@ -46853,7 +46179,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -46867,8 +46193,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkWithProrationPrice = - NewSubscriptionBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -46891,7 +46217,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -48065,7 +47391,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -48075,10 +47401,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewSubscriptionScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -48493,7 +47819,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -48506,7 +47832,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -48535,40 +47861,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithUnitPricingPrice: - NewSubscriptionScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithUnitPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithUnitPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithUnitPricingPrice.modelType - name = newSubscriptionScalableMatrixWithUnitPricingPrice.name + cadence = scalableMatrixWithUnitPricing.cadence + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name scalableMatrixWithUnitPricingConfig = - newSubscriptionScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithUnitPricingPrice.billedInAdvance + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithUnitPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithUnitPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithUnitPricingPrice.invoiceGroupingKey + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + currency = scalableMatrixWithUnitPricing.currency + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithUnitPricingPrice.metadata - referenceId = newSubscriptionScalableMatrixWithUnitPricingPrice.referenceId + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata + referenceId = scalableMatrixWithUnitPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -48952,8 +48267,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -48967,8 +48281,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithUnitPricingPrice = - NewSubscriptionScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -48994,7 +48308,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -50171,7 +49485,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -50181,10 +49495,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -50599,7 +49913,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -50612,7 +49926,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -50641,41 +49955,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithTieredPricingPrice: - NewSubscriptionScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithTieredPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithTieredPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithTieredPricingPrice.modelType - name = newSubscriptionScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newSubscriptionScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithTieredPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithTieredPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + currency = scalableMatrixWithTieredPricing.currency + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithTieredPricingPrice.metadata - referenceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.referenceId + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata + referenceId = scalableMatrixWithTieredPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -51059,8 +50361,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -51074,8 +50375,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithTieredPricingPrice = - NewSubscriptionScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -51101,7 +50402,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -52282,7 +51583,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -52292,10 +51593,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -52705,7 +52006,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -52718,7 +52019,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -52745,35 +52046,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionCumulativeGroupedBulkPrice: - NewSubscriptionCumulativeGroupedBulkPrice - ) = apply { - cadence = newSubscriptionCumulativeGroupedBulkPrice.cadence + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence cumulativeGroupedBulkConfig = - newSubscriptionCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - itemId = newSubscriptionCumulativeGroupedBulkPrice.itemId - modelType = newSubscriptionCumulativeGroupedBulkPrice.modelType - name = newSubscriptionCumulativeGroupedBulkPrice.name - billableMetricId = - newSubscriptionCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newSubscriptionCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionCumulativeGroupedBulkPrice.conversionRate - currency = newSubscriptionCumulativeGroupedBulkPrice.currency - externalPriceId = newSubscriptionCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionCumulativeGroupedBulkPrice.invoiceGroupingKey + cumulativeGroupedBulk.cumulativeGroupedBulkConfig + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + currency = cumulativeGroupedBulk.currency + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newSubscriptionCumulativeGroupedBulkPrice.metadata - referenceId = newSubscriptionCumulativeGroupedBulkPrice.referenceId + cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata + referenceId = cumulativeGroupedBulk.referenceId additionalProperties = - newSubscriptionCumulativeGroupedBulkPrice.additionalProperties - .toMutableMap() + cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -53149,7 +52442,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -53163,8 +52456,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionCumulativeGroupedBulkPrice = - NewSubscriptionCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired( "cumulativeGroupedBulkConfig", @@ -53190,7 +52483,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -54365,7 +53658,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -54375,10 +53668,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" } - class NewSubscriptionMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -54788,7 +54081,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -54801,7 +54094,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -54828,35 +54121,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMaxGroupTieredPackagePrice: - NewSubscriptionMaxGroupTieredPackagePrice - ) = apply { - cadence = newSubscriptionMaxGroupTieredPackagePrice.cadence - itemId = newSubscriptionMaxGroupTieredPackagePrice.itemId + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + itemId = maxGroupTieredPackage.itemId maxGroupTieredPackageConfig = - newSubscriptionMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newSubscriptionMaxGroupTieredPackagePrice.modelType - name = newSubscriptionMaxGroupTieredPackagePrice.name - billableMetricId = - newSubscriptionMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionMaxGroupTieredPackagePrice.conversionRate - currency = newSubscriptionMaxGroupTieredPackagePrice.currency - externalPriceId = newSubscriptionMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMaxGroupTieredPackagePrice.invoiceGroupingKey + maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + currency = maxGroupTieredPackage.currency + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionMaxGroupTieredPackagePrice.metadata - referenceId = newSubscriptionMaxGroupTieredPackagePrice.referenceId + maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata + referenceId = maxGroupTieredPackage.referenceId additionalProperties = - newSubscriptionMaxGroupTieredPackagePrice.additionalProperties - .toMutableMap() + maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -55232,7 +54517,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -55246,8 +54531,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMaxGroupTieredPackagePrice = - NewSubscriptionMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -55273,7 +54558,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -56448,7 +55733,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -56458,10 +55743,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" + "MaxGroupTieredPackage{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" } - class NewSubscriptionGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val groupedWithMeteredMinimumConfig: @@ -56874,7 +56159,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -56887,7 +56172,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -56915,41 +56200,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithMeteredMinimumPrice: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithMeteredMinimumPrice.cadence - groupedWithMeteredMinimumConfig = - newSubscriptionGroupedWithMeteredMinimumPrice - .groupedWithMeteredMinimumConfig - itemId = newSubscriptionGroupedWithMeteredMinimumPrice.itemId - modelType = newSubscriptionGroupedWithMeteredMinimumPrice.modelType - name = newSubscriptionGroupedWithMeteredMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithMeteredMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithMeteredMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithMeteredMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithMeteredMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithMeteredMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithMeteredMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + apply { + cadence = groupedWithMeteredMinimum.cadence + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + currency = groupedWithMeteredMinimum.currency + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata + referenceId = groupedWithMeteredMinimum.referenceId + additionalProperties = + groupedWithMeteredMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -57329,8 +56603,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -57344,8 +56617,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithMeteredMinimumPrice = - NewSubscriptionGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithMeteredMinimumConfig", @@ -57371,7 +56644,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -58546,7 +57819,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithMeteredMinimumPrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -58556,10 +57829,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithMeteredMinimumPrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimum{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -58969,7 +58242,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -58982,7 +58255,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -59009,35 +58282,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMatrixWithDisplayNamePrice: - NewSubscriptionMatrixWithDisplayNamePrice - ) = apply { - cadence = newSubscriptionMatrixWithDisplayNamePrice.cadence - itemId = newSubscriptionMatrixWithDisplayNamePrice.itemId + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + itemId = matrixWithDisplayName.itemId matrixWithDisplayNameConfig = - newSubscriptionMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newSubscriptionMatrixWithDisplayNamePrice.modelType - name = newSubscriptionMatrixWithDisplayNamePrice.name - billableMetricId = - newSubscriptionMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newSubscriptionMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixWithDisplayNamePrice.conversionRate - currency = newSubscriptionMatrixWithDisplayNamePrice.currency - externalPriceId = newSubscriptionMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMatrixWithDisplayNamePrice.invoiceGroupingKey + matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + currency = matrixWithDisplayName.currency + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newSubscriptionMatrixWithDisplayNamePrice.metadata - referenceId = newSubscriptionMatrixWithDisplayNamePrice.referenceId + matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata + referenceId = matrixWithDisplayName.referenceId additionalProperties = - newSubscriptionMatrixWithDisplayNamePrice.additionalProperties - .toMutableMap() + matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -59413,7 +58678,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -59427,8 +58692,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixWithDisplayNamePrice = - NewSubscriptionMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -59454,7 +58719,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -60629,7 +59894,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixWithDisplayNamePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -60639,10 +59904,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixWithDisplayNamePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "MatrixWithDisplayName{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, @@ -61052,7 +60317,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedTieredPackagePrice]. + * [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -61065,7 +60330,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -61091,34 +60356,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedTieredPackagePrice: - NewSubscriptionGroupedTieredPackagePrice - ) = apply { - cadence = newSubscriptionGroupedTieredPackagePrice.cadence - groupedTieredPackageConfig = - newSubscriptionGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newSubscriptionGroupedTieredPackagePrice.itemId - modelType = newSubscriptionGroupedTieredPackagePrice.modelType - name = newSubscriptionGroupedTieredPackagePrice.name - billableMetricId = newSubscriptionGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedTieredPackagePrice.conversionRate - currency = newSubscriptionGroupedTieredPackagePrice.currency - externalPriceId = newSubscriptionGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedTieredPackagePrice.invoiceGroupingKey + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + currency = groupedTieredPackage.currency + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedTieredPackagePrice.metadata - referenceId = newSubscriptionGroupedTieredPackagePrice.referenceId + groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata + referenceId = groupedTieredPackage.referenceId additionalProperties = - newSubscriptionGroupedTieredPackagePrice.additionalProperties - .toMutableMap() + groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -61494,7 +60751,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -61508,8 +60765,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedTieredPackagePrice = - NewSubscriptionGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), @@ -61532,7 +60789,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -62706,7 +61963,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedTieredPackagePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackage && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -62716,7 +61973,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedTieredPackagePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedTieredPackage{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } @@ -63611,32 +62868,26 @@ private constructor( /** * Alias for calling [adjustment] with - * `Adjustment.ofNewPercentageDiscount(newPercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = - adjustment(Adjustment.ofNewPercentageDiscount(newPercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewUsageDiscount(newUsageDiscount)`. - */ - fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = - adjustment(Adjustment.ofNewUsageDiscount(newUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofNewAmountDiscount(newAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = - adjustment(Adjustment.ofNewAmountDiscount(newAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMinimum(newMinimum)`. */ - fun adjustment(newMinimum: Adjustment.NewMinimum) = - adjustment(Adjustment.ofNewMinimum(newMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** Alias for calling [adjustment] with `Adjustment.ofNewMaximum(newMaximum)`. */ - fun adjustment(newMaximum: Adjustment.NewMaximum) = - adjustment(Adjustment.ofNewMaximum(newMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The id of the adjustment on the plan to replace in the subscription. */ fun replacesAdjustmentId(replacesAdjustmentId: String) = @@ -63729,60 +62980,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val newPercentageDiscount: NewPercentageDiscount? = null, - private val newUsageDiscount: NewUsageDiscount? = null, - private val newAmountDiscount: NewAmountDiscount? = null, - private val newMinimum: NewMinimum? = null, - private val newMaximum: NewMaximum? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun newPercentageDiscount(): Optional = - Optional.ofNullable(newPercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun newUsageDiscount(): Optional = - Optional.ofNullable(newUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun newAmountDiscount(): Optional = - Optional.ofNullable(newAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun newMinimum(): Optional = Optional.ofNullable(newMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun newMaximum(): Optional = Optional.ofNullable(newMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isNewPercentageDiscount(): Boolean = newPercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isNewUsageDiscount(): Boolean = newUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isNewAmountDiscount(): Boolean = newAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isNewMinimum(): Boolean = newMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isNewMaximum(): Boolean = newMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asNewPercentageDiscount(): NewPercentageDiscount = - newPercentageDiscount.getOrThrow("newPercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asNewUsageDiscount(): NewUsageDiscount = - newUsageDiscount.getOrThrow("newUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asNewAmountDiscount(): NewAmountDiscount = - newAmountDiscount.getOrThrow("newAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asNewMinimum(): NewMinimum = newMinimum.getOrThrow("newMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asNewMaximum(): NewMaximum = newMaximum.getOrThrow("newMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newPercentageDiscount != null -> - visitor.visitNewPercentageDiscount(newPercentageDiscount) - newUsageDiscount != null -> visitor.visitNewUsageDiscount(newUsageDiscount) - newAmountDiscount != null -> visitor.visitNewAmountDiscount(newAmountDiscount) - newMinimum != null -> visitor.visitNewMinimum(newMinimum) - newMaximum != null -> visitor.visitNewMaximum(newMaximum) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -63795,26 +63042,26 @@ private constructor( accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - newPercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) { - newUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) { - newAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitNewMinimum(newMinimum: NewMinimum) { - newMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitNewMaximum(newMaximum: NewMaximum) { - newMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -63839,19 +63086,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewPercentageDiscount( - newPercentageDiscount: NewPercentageDiscount - ) = newPercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - newUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - newAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitNewMinimum(newMinimum: NewMinimum) = newMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitNewMaximum(newMaximum: NewMaximum) = newMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -63862,19 +63109,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && newPercentageDiscount == other.newPercentageDiscount && newUsageDiscount == other.newUsageDiscount && newAmountDiscount == other.newAmountDiscount && newMinimum == other.newMinimum && newMaximum == other.newMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPercentageDiscount, newUsageDiscount, newAmountDiscount, newMinimum, newMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentageDiscount, usageDiscount, amountDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - newPercentageDiscount != null -> - "Adjustment{newPercentageDiscount=$newPercentageDiscount}" - newUsageDiscount != null -> "Adjustment{newUsageDiscount=$newUsageDiscount}" - newAmountDiscount != null -> "Adjustment{newAmountDiscount=$newAmountDiscount}" - newMinimum != null -> "Adjustment{newMinimum=$newMinimum}" - newMaximum != null -> "Adjustment{newMaximum=$newMaximum}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -63882,22 +63129,20 @@ private constructor( companion object { @JvmStatic - fun ofNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount) = - Adjustment(newPercentageDiscount = newPercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) @JvmStatic - fun ofNewUsageDiscount(newUsageDiscount: NewUsageDiscount) = - Adjustment(newUsageDiscount = newUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofNewAmountDiscount(newAmountDiscount: NewAmountDiscount) = - Adjustment(newAmountDiscount = newAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) - @JvmStatic - fun ofNewMinimum(newMinimum: NewMinimum) = Adjustment(newMinimum = newMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofNewMaximum(newMaximum: NewMaximum) = Adjustment(newMaximum = newMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -63906,15 +63151,15 @@ private constructor( */ interface Visitor { - fun visitNewPercentageDiscount(newPercentageDiscount: NewPercentageDiscount): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitNewUsageDiscount(newUsageDiscount: NewUsageDiscount): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitNewAmountDiscount(newAmountDiscount: NewAmountDiscount): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitNewMinimum(newMinimum: NewMinimum): T + fun visitMinimum(minimum: Minimum): T - fun visitNewMaximum(newMaximum: NewMaximum): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -63940,28 +63185,28 @@ private constructor( when (adjustmentType) { "percentage_discount" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Adjustment(newPercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "usage_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newUsageDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newAmountDiscount = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMinimum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Adjustment(newMaximum = it, _json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) } ?: Adjustment(_json = json) } } @@ -63978,21 +63223,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.newPercentageDiscount != null -> - generator.writeObject(value.newPercentageDiscount) - value.newUsageDiscount != null -> - generator.writeObject(value.newUsageDiscount) - value.newAmountDiscount != null -> - generator.writeObject(value.newAmountDiscount) - value.newMinimum != null -> generator.writeObject(value.newMinimum) - value.newMaximum != null -> generator.writeObject(value.newMaximum) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class NewPercentageDiscount + class PercentageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -64110,7 +63353,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewPercentageDiscount]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -64121,7 +63364,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewPercentageDiscount]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("percentage_discount") @@ -64131,14 +63374,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - adjustmentType = newPercentageDiscount.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - newPercentageDiscount.appliesToPriceIds.map { it.toMutableList() } - percentageDiscount = newPercentageDiscount.percentageDiscount - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.percentageDiscount = percentageDiscount.percentageDiscount + isInvoiceLevel = percentageDiscount.isInvoiceLevel additionalProperties = - newPercentageDiscount.additionalProperties.toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } /** @@ -64239,7 +63482,7 @@ private constructor( } /** - * Returns an immutable instance of [NewPercentageDiscount]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -64251,8 +63494,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewPercentageDiscount = - NewPercentageDiscount( + fun build(): PercentageDiscount = + PercentageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -64265,7 +63508,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewPercentageDiscount = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -64311,7 +63554,7 @@ private constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -64321,10 +63564,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "PercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewUsageDiscount + class UsageDiscount private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -64440,7 +63683,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewUsageDiscount]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -64451,7 +63694,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewUsageDiscount]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("usage_discount") @@ -64461,13 +63704,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - adjustmentType = newUsageDiscount.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - newUsageDiscount.appliesToPriceIds.map { it.toMutableList() } - usageDiscount = newUsageDiscount.usageDiscount - isInvoiceLevel = newUsageDiscount.isInvoiceLevel - additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + this.usageDiscount = usageDiscount.usageDiscount + isInvoiceLevel = usageDiscount.isInvoiceLevel + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } /** @@ -64568,7 +63811,7 @@ private constructor( } /** - * Returns an immutable instance of [NewUsageDiscount]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -64580,8 +63823,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewUsageDiscount = - NewUsageDiscount( + fun build(): UsageDiscount = + UsageDiscount( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -64594,7 +63837,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewUsageDiscount = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -64638,7 +63881,7 @@ private constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -64648,10 +63891,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "UsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewAmountDiscount + class AmountDiscount private constructor( private val adjustmentType: JsonValue, private val amountDiscount: JsonField, @@ -64767,8 +64010,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewAmountDiscount]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -64779,7 +64021,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewAmountDiscount]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("amount_discount") @@ -64789,13 +64031,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - adjustmentType = newAmountDiscount.adjustmentType - amountDiscount = newAmountDiscount.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - newAmountDiscount.appliesToPriceIds.map { it.toMutableList() } - isInvoiceLevel = newAmountDiscount.isInvoiceLevel - additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } /** @@ -64896,7 +64138,7 @@ private constructor( } /** - * Returns an immutable instance of [NewAmountDiscount]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -64908,8 +64150,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewAmountDiscount = - NewAmountDiscount( + fun build(): AmountDiscount = + AmountDiscount( adjustmentType, checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -64922,7 +64164,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewAmountDiscount = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -64966,7 +64208,7 @@ private constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -64976,10 +64218,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "AmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMinimum + class Minimum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -65117,7 +64359,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMinimum]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -65129,7 +64371,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMinimum]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("minimum") @@ -65140,13 +64382,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMinimum: NewMinimum) = apply { - adjustmentType = newMinimum.adjustmentType - appliesToPriceIds = newMinimum.appliesToPriceIds.map { it.toMutableList() } - itemId = newMinimum.itemId - minimumAmount = newMinimum.minimumAmount - isInvoiceLevel = newMinimum.isInvoiceLevel - additionalProperties = newMinimum.additionalProperties.toMutableMap() + internal fun from(minimum: Minimum) = apply { + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + isInvoiceLevel = minimum.isInvoiceLevel + additionalProperties = minimum.additionalProperties.toMutableMap() } /** @@ -65259,7 +64501,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMinimum]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65272,8 +64514,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMinimum = - NewMinimum( + fun build(): Minimum = + Minimum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -65287,7 +64529,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMinimum = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -65333,7 +64575,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Minimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65343,10 +64585,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Minimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } - class NewMaximum + class Maximum private constructor( private val adjustmentType: JsonValue, private val appliesToPriceIds: JsonField>, @@ -65462,7 +64704,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NewMaximum]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -65473,7 +64715,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewMaximum]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var adjustmentType: JsonValue = JsonValue.from("maximum") @@ -65483,12 +64725,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newMaximum: NewMaximum) = apply { - adjustmentType = newMaximum.adjustmentType - appliesToPriceIds = newMaximum.appliesToPriceIds.map { it.toMutableList() } - maximumAmount = newMaximum.maximumAmount - isInvoiceLevel = newMaximum.isInvoiceLevel - additionalProperties = newMaximum.additionalProperties.toMutableMap() + internal fun from(maximum: Maximum) = apply { + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + maximumAmount = maximum.maximumAmount + isInvoiceLevel = maximum.isInvoiceLevel + additionalProperties = maximum.additionalProperties.toMutableMap() } /** @@ -65589,7 +64831,7 @@ private constructor( } /** - * Returns an immutable instance of [NewMaximum]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -65601,8 +64843,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewMaximum = - NewMaximum( + fun build(): Maximum = + Maximum( adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -65615,7 +64857,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewMaximum = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -65659,7 +64901,7 @@ private constructor( return true } - return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -65669,7 +64911,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" + "Maximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -66146,244 +65388,127 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** - * Alias for calling [price] with `Price.ofNewSubscriptionUnit(newSubscriptionUnit)`. - */ - fun price(newSubscriptionUnit: Price.NewSubscriptionUnitPrice) = - price(Price.ofNewSubscriptionUnit(newSubscriptionUnit)) + /** Alias for calling [price] with `Price.ofUnit(unit)`. */ + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionPackage(newSubscriptionPackage)`. - */ - fun price(newSubscriptionPackage: Price.NewSubscriptionPackagePrice) = - price(Price.ofNewSubscriptionPackage(newSubscriptionPackage)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)`. - */ - fun price(newSubscriptionMatrix: Price.NewSubscriptionMatrixPrice) = - price(Price.ofNewSubscriptionMatrix(newSubscriptionMatrix)) + /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTiered(newSubscriptionTiered)`. - */ - fun price(newSubscriptionTiered: Price.NewSubscriptionTieredPrice) = - price(Price.ofNewSubscriptionTiered(newSubscriptionTiered)) + /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)`. - */ - fun price(newSubscriptionTieredBps: Price.NewSubscriptionTieredBpsPrice) = - price(Price.ofNewSubscriptionTieredBps(newSubscriptionTieredBps)) + /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) - /** Alias for calling [price] with `Price.ofNewSubscriptionBps(newSubscriptionBps)`. */ - fun price(newSubscriptionBps: Price.NewSubscriptionBpsPrice) = - price(Price.ofNewSubscriptionBps(newSubscriptionBps)) + /** Alias for calling [price] with `Price.ofBps(bps)`. */ + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)`. - */ - fun price(newSubscriptionBulkBps: Price.NewSubscriptionBulkBpsPrice) = - price(Price.ofNewSubscriptionBulkBps(newSubscriptionBulkBps)) + /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) - /** - * Alias for calling [price] with `Price.ofNewSubscriptionBulk(newSubscriptionBulk)`. - */ - fun price(newSubscriptionBulk: Price.NewSubscriptionBulkPrice) = - price(Price.ofNewSubscriptionBulk(newSubscriptionBulk)) + /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount)`. + * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price( - newSubscriptionThresholdTotalAmount: Price.NewSubscriptionThresholdTotalAmountPrice - ) = - price( - Price.ofNewSubscriptionThresholdTotalAmount(newSubscriptionThresholdTotalAmount) - ) + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = + price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)`. - */ - fun price(newSubscriptionTieredPackage: Price.NewSubscriptionTieredPackagePrice) = - price(Price.ofNewSubscriptionTieredPackage(newSubscriptionTieredPackage)) + /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ + fun price(tieredPackage: Price.TieredPackage) = + price(Price.ofTieredPackage(tieredPackage)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)`. - */ - fun price( - newSubscriptionTieredWithMinimum: Price.NewSubscriptionTieredWithMinimumPrice - ) = price(Price.ofNewSubscriptionTieredWithMinimum(newSubscriptionTieredWithMinimum)) + /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ + fun price(tieredWithMinimum: Price.TieredWithMinimum) = + price(Price.ofTieredWithMinimum(tieredWithMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)`. - */ - fun price(newSubscriptionUnitWithPercent: Price.NewSubscriptionUnitWithPercentPrice) = - price(Price.ofNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent)) + /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ + fun price(unitWithPercent: Price.UnitWithPercent) = + price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionPackageWithAllocation(newSubscriptionPackageWithAllocation)`. + * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price( - newSubscriptionPackageWithAllocation: - Price.NewSubscriptionPackageWithAllocationPrice - ) = - price( - Price.ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - ) + fun price(packageWithAllocation: Price.PackageWithAllocation) = + price(Price.ofPackageWithAllocation(packageWithAllocation)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)`. + * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price( - newSubscriptionTierWithProration: Price.NewSubscriptionTierWithProrationPrice - ) = price(Price.ofNewSubscriptionTierWithProration(newSubscriptionTierWithProration)) + fun price(tieredWithProration: Price.TieredWithProration) = + price(Price.ofTieredWithProration(tieredWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)`. - */ - fun price( - newSubscriptionUnitWithProration: Price.NewSubscriptionUnitWithProrationPrice - ) = price(Price.ofNewSubscriptionUnitWithProration(newSubscriptionUnitWithProration)) + /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ + fun price(unitWithProration: Price.UnitWithProration) = + price(Price.ofUnitWithProration(unitWithProration)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)`. - */ - fun price( - newSubscriptionGroupedAllocation: Price.NewSubscriptionGroupedAllocationPrice - ) = price(Price.ofNewSubscriptionGroupedAllocation(newSubscriptionGroupedAllocation)) + /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ + fun price(groupedAllocation: Price.GroupedAllocation) = + price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithProratedMinimum(newSubscriptionGroupedWithProratedMinimum)`. + * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price( - newSubscriptionGroupedWithProratedMinimum: - Price.NewSubscriptionGroupedWithProratedMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - ) + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = + price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) - /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)`. - */ - fun price( - newSubscriptionBulkWithProration: Price.NewSubscriptionBulkWithProrationPrice - ) = price(Price.ofNewSubscriptionBulkWithProration(newSubscriptionBulkWithProration)) + /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ + fun price(bulkWithProration: Price.BulkWithProration) = + price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithUnitPricing(newSubscriptionScalableMatrixWithUnitPricing)`. + * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithUnitPricing: - Price.NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - ) + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = + price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionScalableMatrixWithTieredPricing(newSubscriptionScalableMatrixWithTieredPricing)`. + * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price( - newSubscriptionScalableMatrixWithTieredPricing: - Price.NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - price( - Price.ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - ) + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = + price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionCumulativeGroupedBulk(newSubscriptionCumulativeGroupedBulk)`. + * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price( - newSubscriptionCumulativeGroupedBulk: - Price.NewSubscriptionCumulativeGroupedBulkPrice - ) = - price( - Price.ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - ) + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = + price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMaxGroupTieredPackage(newSubscriptionMaxGroupTieredPackage)`. + * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price( - newSubscriptionMaxGroupTieredPackage: - Price.NewSubscriptionMaxGroupTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - ) + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = + price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedWithMeteredMinimum(newSubscriptionGroupedWithMeteredMinimum)`. + * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price( - newSubscriptionGroupedWithMeteredMinimum: - Price.NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - price( - Price.ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - ) + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = + price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with - * `Price.ofNewSubscriptionMatrixWithDisplayName(newSubscriptionMatrixWithDisplayName)`. + * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price( - newSubscriptionMatrixWithDisplayName: - Price.NewSubscriptionMatrixWithDisplayNamePrice - ) = - price( - Price.ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - ) + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = + price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** - * Alias for calling [price] with - * `Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage)`. + * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price( - newSubscriptionGroupedTieredPackage: Price.NewSubscriptionGroupedTieredPackagePrice - ) = - price( - Price.ofNewSubscriptionGroupedTieredPackage(newSubscriptionGroupedTieredPackage) - ) + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = + price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** The id of the price to add to the subscription. */ fun priceId(priceId: String?) = priceId(JsonField.ofNullable(priceId)) @@ -67434,401 +66559,257 @@ private constructor( @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val newSubscriptionUnit: NewSubscriptionUnitPrice? = null, - private val newSubscriptionPackage: NewSubscriptionPackagePrice? = null, - private val newSubscriptionMatrix: NewSubscriptionMatrixPrice? = null, - private val newSubscriptionTiered: NewSubscriptionTieredPrice? = null, - private val newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice? = null, - private val newSubscriptionBps: NewSubscriptionBpsPrice? = null, - private val newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice? = null, - private val newSubscriptionBulk: NewSubscriptionBulkPrice? = null, - private val newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice? = - null, - private val newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice? = null, - private val newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice? = - null, - private val newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice? = null, - private val newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice? = - null, - private val newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice? = - null, - private val newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice? = - null, - private val newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice? = - null, - private val newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice? = - null, - private val newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice? = - null, - private val newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice? = - null, - private val newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice? = - null, - private val newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice? = - null, - private val newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice? = - null, - private val newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice? = - null, - private val newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice? = - null, - private val newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice? = - null, + private val unit: Unit? = null, + private val package_: Package? = null, + private val matrix: Matrix? = null, + private val tiered: Tiered? = null, + private val tieredBps: TieredBps? = null, + private val bps: Bps? = null, + private val bulkBps: BulkBps? = null, + private val bulk: Bulk? = null, + private val thresholdTotalAmount: ThresholdTotalAmount? = null, + private val tieredPackage: TieredPackage? = null, + private val tieredWithMinimum: TieredWithMinimum? = null, + private val unitWithPercent: UnitWithPercent? = null, + private val packageWithAllocation: PackageWithAllocation? = null, + private val tieredWithProration: TieredWithProration? = null, + private val unitWithProration: UnitWithProration? = null, + private val groupedAllocation: GroupedAllocation? = null, + private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null, + private val bulkWithProration: BulkWithProration? = null, + private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null, + private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null, + private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null, + private val maxGroupTieredPackage: MaxGroupTieredPackage? = null, + private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null, + private val matrixWithDisplayName: MatrixWithDisplayName? = null, + private val groupedTieredPackage: GroupedTieredPackage? = null, private val _json: JsonValue? = null, ) { - fun newSubscriptionUnit(): Optional = - Optional.ofNullable(newSubscriptionUnit) + fun unit(): Optional = Optional.ofNullable(unit) - fun newSubscriptionPackage(): Optional = - Optional.ofNullable(newSubscriptionPackage) + fun package_(): Optional = Optional.ofNullable(package_) - fun newSubscriptionMatrix(): Optional = - Optional.ofNullable(newSubscriptionMatrix) + fun matrix(): Optional = Optional.ofNullable(matrix) - fun newSubscriptionTiered(): Optional = - Optional.ofNullable(newSubscriptionTiered) + fun tiered(): Optional = Optional.ofNullable(tiered) - fun newSubscriptionTieredBps(): Optional = - Optional.ofNullable(newSubscriptionTieredBps) + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun newSubscriptionBps(): Optional = - Optional.ofNullable(newSubscriptionBps) + fun bps(): Optional = Optional.ofNullable(bps) - fun newSubscriptionBulkBps(): Optional = - Optional.ofNullable(newSubscriptionBulkBps) + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun newSubscriptionBulk(): Optional = - Optional.ofNullable(newSubscriptionBulk) + fun bulk(): Optional = Optional.ofNullable(bulk) - fun newSubscriptionThresholdTotalAmount(): - Optional = - Optional.ofNullable(newSubscriptionThresholdTotalAmount) + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun newSubscriptionTieredPackage(): Optional = - Optional.ofNullable(newSubscriptionTieredPackage) + fun tieredPackage(): Optional = Optional.ofNullable(tieredPackage) - fun newSubscriptionTieredWithMinimum(): - Optional = - Optional.ofNullable(newSubscriptionTieredWithMinimum) + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun newSubscriptionUnitWithPercent(): Optional = - Optional.ofNullable(newSubscriptionUnitWithPercent) + fun unitWithPercent(): Optional = Optional.ofNullable(unitWithPercent) - fun newSubscriptionPackageWithAllocation(): - Optional = - Optional.ofNullable(newSubscriptionPackageWithAllocation) + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun newSubscriptionTierWithProration(): - Optional = - Optional.ofNullable(newSubscriptionTierWithProration) + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun newSubscriptionUnitWithProration(): - Optional = - Optional.ofNullable(newSubscriptionUnitWithProration) + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun newSubscriptionGroupedAllocation(): - Optional = - Optional.ofNullable(newSubscriptionGroupedAllocation) + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun newSubscriptionGroupedWithProratedMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithProratedMinimum) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun newSubscriptionBulkWithProration(): - Optional = - Optional.ofNullable(newSubscriptionBulkWithProration) + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - fun newSubscriptionScalableMatrixWithUnitPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithUnitPricing) + fun scalableMatrixWithUnitPricing(): Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - fun newSubscriptionScalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(newSubscriptionScalableMatrixWithTieredPricing) + fun scalableMatrixWithTieredPricing(): Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - fun newSubscriptionCumulativeGroupedBulk(): - Optional = - Optional.ofNullable(newSubscriptionCumulativeGroupedBulk) + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - fun newSubscriptionMaxGroupTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionMaxGroupTieredPackage) + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - fun newSubscriptionGroupedWithMeteredMinimum(): - Optional = - Optional.ofNullable(newSubscriptionGroupedWithMeteredMinimum) + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - fun newSubscriptionMatrixWithDisplayName(): - Optional = - Optional.ofNullable(newSubscriptionMatrixWithDisplayName) + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun newSubscriptionGroupedTieredPackage(): - Optional = - Optional.ofNullable(newSubscriptionGroupedTieredPackage) + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - fun isNewSubscriptionUnit(): Boolean = newSubscriptionUnit != null + fun isUnit(): Boolean = unit != null - fun isNewSubscriptionPackage(): Boolean = newSubscriptionPackage != null + fun isPackage(): Boolean = package_ != null - fun isNewSubscriptionMatrix(): Boolean = newSubscriptionMatrix != null + fun isMatrix(): Boolean = matrix != null - fun isNewSubscriptionTiered(): Boolean = newSubscriptionTiered != null + fun isTiered(): Boolean = tiered != null - fun isNewSubscriptionTieredBps(): Boolean = newSubscriptionTieredBps != null + fun isTieredBps(): Boolean = tieredBps != null - fun isNewSubscriptionBps(): Boolean = newSubscriptionBps != null + fun isBps(): Boolean = bps != null - fun isNewSubscriptionBulkBps(): Boolean = newSubscriptionBulkBps != null + fun isBulkBps(): Boolean = bulkBps != null - fun isNewSubscriptionBulk(): Boolean = newSubscriptionBulk != null + fun isBulk(): Boolean = bulk != null - fun isNewSubscriptionThresholdTotalAmount(): Boolean = - newSubscriptionThresholdTotalAmount != null + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - fun isNewSubscriptionTieredPackage(): Boolean = newSubscriptionTieredPackage != null + fun isTieredPackage(): Boolean = tieredPackage != null - fun isNewSubscriptionTieredWithMinimum(): Boolean = - newSubscriptionTieredWithMinimum != null + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - fun isNewSubscriptionUnitWithPercent(): Boolean = newSubscriptionUnitWithPercent != null + fun isUnitWithPercent(): Boolean = unitWithPercent != null - fun isNewSubscriptionPackageWithAllocation(): Boolean = - newSubscriptionPackageWithAllocation != null + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - fun isNewSubscriptionTierWithProration(): Boolean = - newSubscriptionTierWithProration != null + fun isTieredWithProration(): Boolean = tieredWithProration != null - fun isNewSubscriptionUnitWithProration(): Boolean = - newSubscriptionUnitWithProration != null + fun isUnitWithProration(): Boolean = unitWithProration != null - fun isNewSubscriptionGroupedAllocation(): Boolean = - newSubscriptionGroupedAllocation != null + fun isGroupedAllocation(): Boolean = groupedAllocation != null - fun isNewSubscriptionGroupedWithProratedMinimum(): Boolean = - newSubscriptionGroupedWithProratedMinimum != null + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - fun isNewSubscriptionBulkWithProration(): Boolean = - newSubscriptionBulkWithProration != null + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isNewSubscriptionScalableMatrixWithUnitPricing(): Boolean = - newSubscriptionScalableMatrixWithUnitPricing != null + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null - fun isNewSubscriptionScalableMatrixWithTieredPricing(): Boolean = - newSubscriptionScalableMatrixWithTieredPricing != null + fun isScalableMatrixWithTieredPricing(): Boolean = + scalableMatrixWithTieredPricing != null - fun isNewSubscriptionCumulativeGroupedBulk(): Boolean = - newSubscriptionCumulativeGroupedBulk != null + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null - fun isNewSubscriptionMaxGroupTieredPackage(): Boolean = - newSubscriptionMaxGroupTieredPackage != null + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null - fun isNewSubscriptionGroupedWithMeteredMinimum(): Boolean = - newSubscriptionGroupedWithMeteredMinimum != null + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - fun isNewSubscriptionMatrixWithDisplayName(): Boolean = - newSubscriptionMatrixWithDisplayName != null + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - fun isNewSubscriptionGroupedTieredPackage(): Boolean = - newSubscriptionGroupedTieredPackage != null + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - fun asNewSubscriptionUnit(): NewSubscriptionUnitPrice = - newSubscriptionUnit.getOrThrow("newSubscriptionUnit") + fun asUnit(): Unit = unit.getOrThrow("unit") - fun asNewSubscriptionPackage(): NewSubscriptionPackagePrice = - newSubscriptionPackage.getOrThrow("newSubscriptionPackage") + fun asPackage(): Package = package_.getOrThrow("package_") - fun asNewSubscriptionMatrix(): NewSubscriptionMatrixPrice = - newSubscriptionMatrix.getOrThrow("newSubscriptionMatrix") + fun asMatrix(): Matrix = matrix.getOrThrow("matrix") - fun asNewSubscriptionTiered(): NewSubscriptionTieredPrice = - newSubscriptionTiered.getOrThrow("newSubscriptionTiered") + fun asTiered(): Tiered = tiered.getOrThrow("tiered") - fun asNewSubscriptionTieredBps(): NewSubscriptionTieredBpsPrice = - newSubscriptionTieredBps.getOrThrow("newSubscriptionTieredBps") + fun asTieredBps(): TieredBps = tieredBps.getOrThrow("tieredBps") - fun asNewSubscriptionBps(): NewSubscriptionBpsPrice = - newSubscriptionBps.getOrThrow("newSubscriptionBps") + fun asBps(): Bps = bps.getOrThrow("bps") - fun asNewSubscriptionBulkBps(): NewSubscriptionBulkBpsPrice = - newSubscriptionBulkBps.getOrThrow("newSubscriptionBulkBps") + fun asBulkBps(): BulkBps = bulkBps.getOrThrow("bulkBps") - fun asNewSubscriptionBulk(): NewSubscriptionBulkPrice = - newSubscriptionBulk.getOrThrow("newSubscriptionBulk") + fun asBulk(): Bulk = bulk.getOrThrow("bulk") - fun asNewSubscriptionThresholdTotalAmount(): NewSubscriptionThresholdTotalAmountPrice = - newSubscriptionThresholdTotalAmount.getOrThrow( - "newSubscriptionThresholdTotalAmount" - ) + fun asThresholdTotalAmount(): ThresholdTotalAmount = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - fun asNewSubscriptionTieredPackage(): NewSubscriptionTieredPackagePrice = - newSubscriptionTieredPackage.getOrThrow("newSubscriptionTieredPackage") + fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage") - fun asNewSubscriptionTieredWithMinimum(): NewSubscriptionTieredWithMinimumPrice = - newSubscriptionTieredWithMinimum.getOrThrow("newSubscriptionTieredWithMinimum") + fun asTieredWithMinimum(): TieredWithMinimum = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - fun asNewSubscriptionUnitWithPercent(): NewSubscriptionUnitWithPercentPrice = - newSubscriptionUnitWithPercent.getOrThrow("newSubscriptionUnitWithPercent") + fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent") - fun asNewSubscriptionPackageWithAllocation(): - NewSubscriptionPackageWithAllocationPrice = - newSubscriptionPackageWithAllocation.getOrThrow( - "newSubscriptionPackageWithAllocation" - ) + fun asPackageWithAllocation(): PackageWithAllocation = + packageWithAllocation.getOrThrow("packageWithAllocation") - fun asNewSubscriptionTierWithProration(): NewSubscriptionTierWithProrationPrice = - newSubscriptionTierWithProration.getOrThrow("newSubscriptionTierWithProration") + fun asTieredWithProration(): TieredWithProration = + tieredWithProration.getOrThrow("tieredWithProration") - fun asNewSubscriptionUnitWithProration(): NewSubscriptionUnitWithProrationPrice = - newSubscriptionUnitWithProration.getOrThrow("newSubscriptionUnitWithProration") + fun asUnitWithProration(): UnitWithProration = + unitWithProration.getOrThrow("unitWithProration") - fun asNewSubscriptionGroupedAllocation(): NewSubscriptionGroupedAllocationPrice = - newSubscriptionGroupedAllocation.getOrThrow("newSubscriptionGroupedAllocation") + fun asGroupedAllocation(): GroupedAllocation = + groupedAllocation.getOrThrow("groupedAllocation") - fun asNewSubscriptionGroupedWithProratedMinimum(): - NewSubscriptionGroupedWithProratedMinimumPrice = - newSubscriptionGroupedWithProratedMinimum.getOrThrow( - "newSubscriptionGroupedWithProratedMinimum" - ) + fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - fun asNewSubscriptionBulkWithProration(): NewSubscriptionBulkWithProrationPrice = - newSubscriptionBulkWithProration.getOrThrow("newSubscriptionBulkWithProration") + fun asBulkWithProration(): BulkWithProration = + bulkWithProration.getOrThrow("bulkWithProration") - fun asNewSubscriptionScalableMatrixWithUnitPricing(): - NewSubscriptionScalableMatrixWithUnitPricingPrice = - newSubscriptionScalableMatrixWithUnitPricing.getOrThrow( - "newSubscriptionScalableMatrixWithUnitPricing" - ) + fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - fun asNewSubscriptionScalableMatrixWithTieredPricing(): - NewSubscriptionScalableMatrixWithTieredPricingPrice = - newSubscriptionScalableMatrixWithTieredPricing.getOrThrow( - "newSubscriptionScalableMatrixWithTieredPricing" - ) + fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - fun asNewSubscriptionCumulativeGroupedBulk(): - NewSubscriptionCumulativeGroupedBulkPrice = - newSubscriptionCumulativeGroupedBulk.getOrThrow( - "newSubscriptionCumulativeGroupedBulk" - ) + fun asCumulativeGroupedBulk(): CumulativeGroupedBulk = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") - fun asNewSubscriptionMaxGroupTieredPackage(): - NewSubscriptionMaxGroupTieredPackagePrice = - newSubscriptionMaxGroupTieredPackage.getOrThrow( - "newSubscriptionMaxGroupTieredPackage" - ) + fun asMaxGroupTieredPackage(): MaxGroupTieredPackage = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - fun asNewSubscriptionGroupedWithMeteredMinimum(): - NewSubscriptionGroupedWithMeteredMinimumPrice = - newSubscriptionGroupedWithMeteredMinimum.getOrThrow( - "newSubscriptionGroupedWithMeteredMinimum" - ) + fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - fun asNewSubscriptionMatrixWithDisplayName(): - NewSubscriptionMatrixWithDisplayNamePrice = - newSubscriptionMatrixWithDisplayName.getOrThrow( - "newSubscriptionMatrixWithDisplayName" - ) + fun asMatrixWithDisplayName(): MatrixWithDisplayName = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - fun asNewSubscriptionGroupedTieredPackage(): NewSubscriptionGroupedTieredPackagePrice = - newSubscriptionGroupedTieredPackage.getOrThrow( - "newSubscriptionGroupedTieredPackage" - ) + fun asGroupedTieredPackage(): GroupedTieredPackage = + groupedTieredPackage.getOrThrow("groupedTieredPackage") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - newSubscriptionUnit != null -> - visitor.visitNewSubscriptionUnit(newSubscriptionUnit) - newSubscriptionPackage != null -> - visitor.visitNewSubscriptionPackage(newSubscriptionPackage) - newSubscriptionMatrix != null -> - visitor.visitNewSubscriptionMatrix(newSubscriptionMatrix) - newSubscriptionTiered != null -> - visitor.visitNewSubscriptionTiered(newSubscriptionTiered) - newSubscriptionTieredBps != null -> - visitor.visitNewSubscriptionTieredBps(newSubscriptionTieredBps) - newSubscriptionBps != null -> - visitor.visitNewSubscriptionBps(newSubscriptionBps) - newSubscriptionBulkBps != null -> - visitor.visitNewSubscriptionBulkBps(newSubscriptionBulkBps) - newSubscriptionBulk != null -> - visitor.visitNewSubscriptionBulk(newSubscriptionBulk) - newSubscriptionThresholdTotalAmount != null -> - visitor.visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount - ) - newSubscriptionTieredPackage != null -> - visitor.visitNewSubscriptionTieredPackage(newSubscriptionTieredPackage) - newSubscriptionTieredWithMinimum != null -> - visitor.visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum - ) - newSubscriptionUnitWithPercent != null -> - visitor.visitNewSubscriptionUnitWithPercent(newSubscriptionUnitWithPercent) - newSubscriptionPackageWithAllocation != null -> - visitor.visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation - ) - newSubscriptionTierWithProration != null -> - visitor.visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration - ) - newSubscriptionUnitWithProration != null -> - visitor.visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration - ) - newSubscriptionGroupedAllocation != null -> - visitor.visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation - ) - newSubscriptionGroupedWithProratedMinimum != null -> - visitor.visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum - ) - newSubscriptionBulkWithProration != null -> - visitor.visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration - ) - newSubscriptionScalableMatrixWithUnitPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing - ) - newSubscriptionScalableMatrixWithTieredPricing != null -> - visitor.visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing - ) - newSubscriptionCumulativeGroupedBulk != null -> - visitor.visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk - ) - newSubscriptionMaxGroupTieredPackage != null -> - visitor.visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage - ) - newSubscriptionGroupedWithMeteredMinimum != null -> - visitor.visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum - ) - newSubscriptionMatrixWithDisplayName != null -> - visitor.visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName - ) - newSubscriptionGroupedTieredPackage != null -> - visitor.visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredWithProration != null -> + visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing ) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) else -> visitor.unknown(_json) } @@ -67841,164 +66822,126 @@ private constructor( accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) { - newSubscriptionUnit.validate() + override fun visitUnit(unit: Unit) { + unit.validate() } - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) { - newSubscriptionPackage.validate() + override fun visitPackage(package_: Package) { + package_.validate() } - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) { - newSubscriptionMatrix.validate() + override fun visitMatrix(matrix: Matrix) { + matrix.validate() } - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) { - newSubscriptionTiered.validate() + override fun visitTiered(tiered: Tiered) { + tiered.validate() } - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) { - newSubscriptionTieredBps.validate() + override fun visitTieredBps(tieredBps: TieredBps) { + tieredBps.validate() } - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) { - newSubscriptionBps.validate() + override fun visitBps(bps: Bps) { + bps.validate() } - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) { - newSubscriptionBulkBps.validate() + override fun visitBulkBps(bulkBps: BulkBps) { + bulkBps.validate() } - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) { - newSubscriptionBulk.validate() + override fun visitBulk(bulk: Bulk) { + bulk.validate() } - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount ) { - newSubscriptionThresholdTotalAmount.validate() + thresholdTotalAmount.validate() } - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) { - newSubscriptionTieredPackage.validate() + override fun visitTieredPackage(tieredPackage: TieredPackage) { + tieredPackage.validate() } - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) { - newSubscriptionTieredWithMinimum.validate() + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) { + tieredWithMinimum.validate() } - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) { - newSubscriptionUnitWithPercent.validate() + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) { + unitWithPercent.validate() } - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation ) { - newSubscriptionPackageWithAllocation.validate() + packageWithAllocation.validate() } - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration ) { - newSubscriptionTierWithProration.validate() + tieredWithProration.validate() } - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) { - newSubscriptionUnitWithProration.validate() + override fun visitUnitWithProration(unitWithProration: UnitWithProration) { + unitWithProration.validate() } - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) { - newSubscriptionGroupedAllocation.validate() + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) { + groupedAllocation.validate() } - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ) { - newSubscriptionGroupedWithProratedMinimum.validate() + groupedWithProratedMinimum.validate() } - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) { - newSubscriptionBulkWithProration.validate() + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) { + bulkWithProration.validate() } - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) { - newSubscriptionScalableMatrixWithUnitPricing.validate() + scalableMatrixWithUnitPricing.validate() } - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) { - newSubscriptionScalableMatrixWithTieredPricing.validate() + scalableMatrixWithTieredPricing.validate() } - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk ) { - newSubscriptionCumulativeGroupedBulk.validate() + cumulativeGroupedBulk.validate() } - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage ) { - newSubscriptionMaxGroupTieredPackage.validate() + maxGroupTieredPackage.validate() } - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ) { - newSubscriptionGroupedWithMeteredMinimum.validate() + groupedWithMeteredMinimum.validate() } - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName ) { - newSubscriptionMatrixWithDisplayName.validate() + matrixWithDisplayName.validate() } - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage ) { - newSubscriptionGroupedTieredPackage.validate() + groupedTieredPackage.validate() } } ) @@ -68023,115 +66966,83 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitNewSubscriptionUnit( - newSubscriptionUnit: NewSubscriptionUnitPrice - ) = newSubscriptionUnit.validity() - - override fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ) = newSubscriptionPackage.validity() - - override fun visitNewSubscriptionMatrix( - newSubscriptionMatrix: NewSubscriptionMatrixPrice - ) = newSubscriptionMatrix.validity() - - override fun visitNewSubscriptionTiered( - newSubscriptionTiered: NewSubscriptionTieredPrice - ) = newSubscriptionTiered.validity() - - override fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = newSubscriptionTieredBps.validity() - - override fun visitNewSubscriptionBps( - newSubscriptionBps: NewSubscriptionBpsPrice - ) = newSubscriptionBps.validity() - - override fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ) = newSubscriptionBulkBps.validity() - - override fun visitNewSubscriptionBulk( - newSubscriptionBulk: NewSubscriptionBulkPrice - ) = newSubscriptionBulk.validity() - - override fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: - NewSubscriptionThresholdTotalAmountPrice - ) = newSubscriptionThresholdTotalAmount.validity() - - override fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = newSubscriptionTieredPackage.validity() - - override fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = newSubscriptionTieredWithMinimum.validity() - - override fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = newSubscriptionUnitWithPercent.validity() - - override fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: - NewSubscriptionPackageWithAllocationPrice - ) = newSubscriptionPackageWithAllocation.validity() - - override fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = newSubscriptionTierWithProration.validity() - - override fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = newSubscriptionUnitWithProration.validity() - - override fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = newSubscriptionGroupedAllocation.validity() - - override fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = newSubscriptionGroupedWithProratedMinimum.validity() - - override fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = newSubscriptionBulkWithProration.validity() - - override fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = newSubscriptionScalableMatrixWithUnitPricing.validity() - - override fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = newSubscriptionScalableMatrixWithTieredPricing.validity() - - override fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: - NewSubscriptionCumulativeGroupedBulkPrice - ) = newSubscriptionCumulativeGroupedBulk.validity() - - override fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: - NewSubscriptionMaxGroupTieredPackagePrice - ) = newSubscriptionMaxGroupTieredPackage.validity() - - override fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = newSubscriptionGroupedWithMeteredMinimum.validity() - - override fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: - NewSubscriptionMatrixWithDisplayNamePrice - ) = newSubscriptionMatrixWithDisplayName.validity() - - override fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: - NewSubscriptionGroupedTieredPackagePrice - ) = newSubscriptionGroupedTieredPackage.validity() + override fun visitUnit(unit: Unit) = unit.validity() + + override fun visitPackage(package_: Package) = package_.validity() + + override fun visitMatrix(matrix: Matrix) = matrix.validity() + + override fun visitTiered(tiered: Tiered) = tiered.validity() + + override fun visitTieredBps(tieredBps: TieredBps) = tieredBps.validity() + + override fun visitBps(bps: Bps) = bps.validity() + + override fun visitBulkBps(bulkBps: BulkBps) = bulkBps.validity() + + override fun visitBulk(bulk: Bulk) = bulk.validity() + + override fun visitThresholdTotalAmount( + thresholdTotalAmount: ThresholdTotalAmount + ) = thresholdTotalAmount.validity() + + override fun visitTieredPackage(tieredPackage: TieredPackage) = + tieredPackage.validity() + + override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + tieredWithMinimum.validity() + + override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) = + unitWithPercent.validity() + + override fun visitPackageWithAllocation( + packageWithAllocation: PackageWithAllocation + ) = packageWithAllocation.validity() + + override fun visitTieredWithProration( + tieredWithProration: TieredWithProration + ) = tieredWithProration.validity() + + override fun visitUnitWithProration(unitWithProration: UnitWithProration) = + unitWithProration.validity() + + override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) = + groupedAllocation.validity() + + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = groupedWithProratedMinimum.validity() + + override fun visitBulkWithProration(bulkWithProration: BulkWithProration) = + bulkWithProration.validity() + + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = scalableMatrixWithUnitPricing.validity() + + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = scalableMatrixWithTieredPricing.validity() + + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: CumulativeGroupedBulk + ) = cumulativeGroupedBulk.validity() + + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: MaxGroupTieredPackage + ) = maxGroupTieredPackage.validity() + + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = groupedWithMeteredMinimum.validity() + + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: MatrixWithDisplayName + ) = matrixWithDisplayName.validity() + + override fun visitGroupedTieredPackage( + groupedTieredPackage: GroupedTieredPackage + ) = groupedTieredPackage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -68142,215 +67053,141 @@ private constructor( return true } - return /* spotless:off */ other is Price && newSubscriptionUnit == other.newSubscriptionUnit && newSubscriptionPackage == other.newSubscriptionPackage && newSubscriptionMatrix == other.newSubscriptionMatrix && newSubscriptionTiered == other.newSubscriptionTiered && newSubscriptionTieredBps == other.newSubscriptionTieredBps && newSubscriptionBps == other.newSubscriptionBps && newSubscriptionBulkBps == other.newSubscriptionBulkBps && newSubscriptionBulk == other.newSubscriptionBulk && newSubscriptionThresholdTotalAmount == other.newSubscriptionThresholdTotalAmount && newSubscriptionTieredPackage == other.newSubscriptionTieredPackage && newSubscriptionTieredWithMinimum == other.newSubscriptionTieredWithMinimum && newSubscriptionUnitWithPercent == other.newSubscriptionUnitWithPercent && newSubscriptionPackageWithAllocation == other.newSubscriptionPackageWithAllocation && newSubscriptionTierWithProration == other.newSubscriptionTierWithProration && newSubscriptionUnitWithProration == other.newSubscriptionUnitWithProration && newSubscriptionGroupedAllocation == other.newSubscriptionGroupedAllocation && newSubscriptionGroupedWithProratedMinimum == other.newSubscriptionGroupedWithProratedMinimum && newSubscriptionBulkWithProration == other.newSubscriptionBulkWithProration && newSubscriptionScalableMatrixWithUnitPricing == other.newSubscriptionScalableMatrixWithUnitPricing && newSubscriptionScalableMatrixWithTieredPricing == other.newSubscriptionScalableMatrixWithTieredPricing && newSubscriptionCumulativeGroupedBulk == other.newSubscriptionCumulativeGroupedBulk && newSubscriptionMaxGroupTieredPackage == other.newSubscriptionMaxGroupTieredPackage && newSubscriptionGroupedWithMeteredMinimum == other.newSubscriptionGroupedWithMeteredMinimum && newSubscriptionMatrixWithDisplayName == other.newSubscriptionMatrixWithDisplayName && newSubscriptionGroupedTieredPackage == other.newSubscriptionGroupedTieredPackage /* spotless:on */ + return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && bulkWithProration == other.bulkWithProration && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk && maxGroupTieredPackage == other.maxGroupTieredPackage && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && groupedTieredPackage == other.groupedTieredPackage /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newSubscriptionUnit, newSubscriptionPackage, newSubscriptionMatrix, newSubscriptionTiered, newSubscriptionTieredBps, newSubscriptionBps, newSubscriptionBulkBps, newSubscriptionBulk, newSubscriptionThresholdTotalAmount, newSubscriptionTieredPackage, newSubscriptionTieredWithMinimum, newSubscriptionUnitWithPercent, newSubscriptionPackageWithAllocation, newSubscriptionTierWithProration, newSubscriptionUnitWithProration, newSubscriptionGroupedAllocation, newSubscriptionGroupedWithProratedMinimum, newSubscriptionBulkWithProration, newSubscriptionScalableMatrixWithUnitPricing, newSubscriptionScalableMatrixWithTieredPricing, newSubscriptionCumulativeGroupedBulk, newSubscriptionMaxGroupTieredPackage, newSubscriptionGroupedWithMeteredMinimum, newSubscriptionMatrixWithDisplayName, newSubscriptionGroupedTieredPackage) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, bulkWithProration, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk, maxGroupTieredPackage, groupedWithMeteredMinimum, matrixWithDisplayName, groupedTieredPackage) /* spotless:on */ override fun toString(): String = when { - newSubscriptionUnit != null -> "Price{newSubscriptionUnit=$newSubscriptionUnit}" - newSubscriptionPackage != null -> - "Price{newSubscriptionPackage=$newSubscriptionPackage}" - newSubscriptionMatrix != null -> - "Price{newSubscriptionMatrix=$newSubscriptionMatrix}" - newSubscriptionTiered != null -> - "Price{newSubscriptionTiered=$newSubscriptionTiered}" - newSubscriptionTieredBps != null -> - "Price{newSubscriptionTieredBps=$newSubscriptionTieredBps}" - newSubscriptionBps != null -> "Price{newSubscriptionBps=$newSubscriptionBps}" - newSubscriptionBulkBps != null -> - "Price{newSubscriptionBulkBps=$newSubscriptionBulkBps}" - newSubscriptionBulk != null -> "Price{newSubscriptionBulk=$newSubscriptionBulk}" - newSubscriptionThresholdTotalAmount != null -> - "Price{newSubscriptionThresholdTotalAmount=$newSubscriptionThresholdTotalAmount}" - newSubscriptionTieredPackage != null -> - "Price{newSubscriptionTieredPackage=$newSubscriptionTieredPackage}" - newSubscriptionTieredWithMinimum != null -> - "Price{newSubscriptionTieredWithMinimum=$newSubscriptionTieredWithMinimum}" - newSubscriptionUnitWithPercent != null -> - "Price{newSubscriptionUnitWithPercent=$newSubscriptionUnitWithPercent}" - newSubscriptionPackageWithAllocation != null -> - "Price{newSubscriptionPackageWithAllocation=$newSubscriptionPackageWithAllocation}" - newSubscriptionTierWithProration != null -> - "Price{newSubscriptionTierWithProration=$newSubscriptionTierWithProration}" - newSubscriptionUnitWithProration != null -> - "Price{newSubscriptionUnitWithProration=$newSubscriptionUnitWithProration}" - newSubscriptionGroupedAllocation != null -> - "Price{newSubscriptionGroupedAllocation=$newSubscriptionGroupedAllocation}" - newSubscriptionGroupedWithProratedMinimum != null -> - "Price{newSubscriptionGroupedWithProratedMinimum=$newSubscriptionGroupedWithProratedMinimum}" - newSubscriptionBulkWithProration != null -> - "Price{newSubscriptionBulkWithProration=$newSubscriptionBulkWithProration}" - newSubscriptionScalableMatrixWithUnitPricing != null -> - "Price{newSubscriptionScalableMatrixWithUnitPricing=$newSubscriptionScalableMatrixWithUnitPricing}" - newSubscriptionScalableMatrixWithTieredPricing != null -> - "Price{newSubscriptionScalableMatrixWithTieredPricing=$newSubscriptionScalableMatrixWithTieredPricing}" - newSubscriptionCumulativeGroupedBulk != null -> - "Price{newSubscriptionCumulativeGroupedBulk=$newSubscriptionCumulativeGroupedBulk}" - newSubscriptionMaxGroupTieredPackage != null -> - "Price{newSubscriptionMaxGroupTieredPackage=$newSubscriptionMaxGroupTieredPackage}" - newSubscriptionGroupedWithMeteredMinimum != null -> - "Price{newSubscriptionGroupedWithMeteredMinimum=$newSubscriptionGroupedWithMeteredMinimum}" - newSubscriptionMatrixWithDisplayName != null -> - "Price{newSubscriptionMatrixWithDisplayName=$newSubscriptionMatrixWithDisplayName}" - newSubscriptionGroupedTieredPackage != null -> - "Price{newSubscriptionGroupedTieredPackage=$newSubscriptionGroupedTieredPackage}" + unit != null -> "Price{unit=$unit}" + package_ != null -> "Price{package_=$package_}" + matrix != null -> "Price{matrix=$matrix}" + tiered != null -> "Price{tiered=$tiered}" + tieredBps != null -> "Price{tieredBps=$tieredBps}" + bps != null -> "Price{bps=$bps}" + bulkBps != null -> "Price{bulkBps=$bulkBps}" + bulk != null -> "Price{bulk=$bulk}" + thresholdTotalAmount != null -> + "Price{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" + tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" + unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" + packageWithAllocation != null -> + "Price{packageWithAllocation=$packageWithAllocation}" + tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" + scalableMatrixWithUnitPricing != null -> + "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" + maxGroupTieredPackage != null -> + "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" + groupedWithMeteredMinimum != null -> + "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "Price{matrixWithDisplayName=$matrixWithDisplayName}" + groupedTieredPackage != null -> + "Price{groupedTieredPackage=$groupedTieredPackage}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } companion object { - @JvmStatic - fun ofNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice) = - Price(newSubscriptionUnit = newSubscriptionUnit) + @JvmStatic fun ofUnit(unit: Unit) = Price(unit = unit) - @JvmStatic - fun ofNewSubscriptionPackage(newSubscriptionPackage: NewSubscriptionPackagePrice) = - Price(newSubscriptionPackage = newSubscriptionPackage) + @JvmStatic fun ofPackage(package_: Package) = Price(package_ = package_) - @JvmStatic - fun ofNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice) = - Price(newSubscriptionMatrix = newSubscriptionMatrix) + @JvmStatic fun ofMatrix(matrix: Matrix) = Price(matrix = matrix) - @JvmStatic - fun ofNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice) = - Price(newSubscriptionTiered = newSubscriptionTiered) + @JvmStatic fun ofTiered(tiered: Tiered) = Price(tiered = tiered) - @JvmStatic - fun ofNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ) = Price(newSubscriptionTieredBps = newSubscriptionTieredBps) + @JvmStatic fun ofTieredBps(tieredBps: TieredBps) = Price(tieredBps = tieredBps) - @JvmStatic - fun ofNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice) = - Price(newSubscriptionBps = newSubscriptionBps) + @JvmStatic fun ofBps(bps: Bps) = Price(bps = bps) - @JvmStatic - fun ofNewSubscriptionBulkBps(newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice) = - Price(newSubscriptionBulkBps = newSubscriptionBulkBps) + @JvmStatic fun ofBulkBps(bulkBps: BulkBps) = Price(bulkBps = bulkBps) - @JvmStatic - fun ofNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice) = - Price(newSubscriptionBulk = newSubscriptionBulk) + @JvmStatic fun ofBulk(bulk: Bulk) = Price(bulk = bulk) @JvmStatic - fun ofNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ) = Price(newSubscriptionThresholdTotalAmount = newSubscriptionThresholdTotalAmount) + fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) = + Price(thresholdTotalAmount = thresholdTotalAmount) @JvmStatic - fun ofNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ) = Price(newSubscriptionTieredPackage = newSubscriptionTieredPackage) + fun ofTieredPackage(tieredPackage: TieredPackage) = + Price(tieredPackage = tieredPackage) @JvmStatic - fun ofNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ) = Price(newSubscriptionTieredWithMinimum = newSubscriptionTieredWithMinimum) + fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) = + Price(tieredWithMinimum = tieredWithMinimum) @JvmStatic - fun ofNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ) = Price(newSubscriptionUnitWithPercent = newSubscriptionUnitWithPercent) + fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) = + Price(unitWithPercent = unitWithPercent) @JvmStatic - fun ofNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ) = - Price( - newSubscriptionPackageWithAllocation = newSubscriptionPackageWithAllocation - ) + fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) = + Price(packageWithAllocation = packageWithAllocation) @JvmStatic - fun ofNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ) = Price(newSubscriptionTierWithProration = newSubscriptionTierWithProration) + fun ofTieredWithProration(tieredWithProration: TieredWithProration) = + Price(tieredWithProration = tieredWithProration) @JvmStatic - fun ofNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ) = Price(newSubscriptionUnitWithProration = newSubscriptionUnitWithProration) + fun ofUnitWithProration(unitWithProration: UnitWithProration) = + Price(unitWithProration = unitWithProration) @JvmStatic - fun ofNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ) = Price(newSubscriptionGroupedAllocation = newSubscriptionGroupedAllocation) + fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) = + Price(groupedAllocation = groupedAllocation) @JvmStatic - fun ofNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = - Price( - newSubscriptionGroupedWithProratedMinimum = - newSubscriptionGroupedWithProratedMinimum - ) + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum + ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) @JvmStatic - fun ofNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ) = Price(newSubscriptionBulkWithProration = newSubscriptionBulkWithProration) + fun ofBulkWithProration(bulkWithProration: BulkWithProration) = + Price(bulkWithProration = bulkWithProration) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithUnitPricing = - newSubscriptionScalableMatrixWithUnitPricing - ) + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing + ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) @JvmStatic - fun ofNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice - ) = - Price( - newSubscriptionScalableMatrixWithTieredPricing = - newSubscriptionScalableMatrixWithTieredPricing - ) + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing + ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) @JvmStatic - fun ofNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ) = - Price( - newSubscriptionCumulativeGroupedBulk = newSubscriptionCumulativeGroupedBulk - ) + fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) = + Price(cumulativeGroupedBulk = cumulativeGroupedBulk) @JvmStatic - fun ofNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ) = - Price( - newSubscriptionMaxGroupTieredPackage = newSubscriptionMaxGroupTieredPackage - ) + fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) = + Price(maxGroupTieredPackage = maxGroupTieredPackage) @JvmStatic - fun ofNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = - Price( - newSubscriptionGroupedWithMeteredMinimum = - newSubscriptionGroupedWithMeteredMinimum - ) + fun ofGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum + ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) @JvmStatic - fun ofNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ) = - Price( - newSubscriptionMatrixWithDisplayName = newSubscriptionMatrixWithDisplayName - ) + fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) = + Price(matrixWithDisplayName = matrixWithDisplayName) @JvmStatic - fun ofNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ) = Price(newSubscriptionGroupedTieredPackage = newSubscriptionGroupedTieredPackage) + fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) = + Price(groupedTieredPackage = groupedTieredPackage) } /** @@ -68358,99 +67195,63 @@ private constructor( */ interface Visitor { - fun visitNewSubscriptionUnit(newSubscriptionUnit: NewSubscriptionUnitPrice): T + fun visitUnit(unit: Unit): T - fun visitNewSubscriptionPackage( - newSubscriptionPackage: NewSubscriptionPackagePrice - ): T + fun visitPackage(package_: Package): T - fun visitNewSubscriptionMatrix(newSubscriptionMatrix: NewSubscriptionMatrixPrice): T + fun visitMatrix(matrix: Matrix): T - fun visitNewSubscriptionTiered(newSubscriptionTiered: NewSubscriptionTieredPrice): T + fun visitTiered(tiered: Tiered): T - fun visitNewSubscriptionTieredBps( - newSubscriptionTieredBps: NewSubscriptionTieredBpsPrice - ): T + fun visitTieredBps(tieredBps: TieredBps): T - fun visitNewSubscriptionBps(newSubscriptionBps: NewSubscriptionBpsPrice): T + fun visitBps(bps: Bps): T - fun visitNewSubscriptionBulkBps( - newSubscriptionBulkBps: NewSubscriptionBulkBpsPrice - ): T + fun visitBulkBps(bulkBps: BulkBps): T - fun visitNewSubscriptionBulk(newSubscriptionBulk: NewSubscriptionBulkPrice): T + fun visitBulk(bulk: Bulk): T - fun visitNewSubscriptionThresholdTotalAmount( - newSubscriptionThresholdTotalAmount: NewSubscriptionThresholdTotalAmountPrice - ): T + fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T - fun visitNewSubscriptionTieredPackage( - newSubscriptionTieredPackage: NewSubscriptionTieredPackagePrice - ): T + fun visitTieredPackage(tieredPackage: TieredPackage): T - fun visitNewSubscriptionTieredWithMinimum( - newSubscriptionTieredWithMinimum: NewSubscriptionTieredWithMinimumPrice - ): T + fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T - fun visitNewSubscriptionUnitWithPercent( - newSubscriptionUnitWithPercent: NewSubscriptionUnitWithPercentPrice - ): T + fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T - fun visitNewSubscriptionPackageWithAllocation( - newSubscriptionPackageWithAllocation: NewSubscriptionPackageWithAllocationPrice - ): T + fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T - fun visitNewSubscriptionTierWithProration( - newSubscriptionTierWithProration: NewSubscriptionTierWithProrationPrice - ): T + fun visitTieredWithProration(tieredWithProration: TieredWithProration): T - fun visitNewSubscriptionUnitWithProration( - newSubscriptionUnitWithProration: NewSubscriptionUnitWithProrationPrice - ): T + fun visitUnitWithProration(unitWithProration: UnitWithProration): T - fun visitNewSubscriptionGroupedAllocation( - newSubscriptionGroupedAllocation: NewSubscriptionGroupedAllocationPrice - ): T + fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T - fun visitNewSubscriptionGroupedWithProratedMinimum( - newSubscriptionGroupedWithProratedMinimum: - NewSubscriptionGroupedWithProratedMinimumPrice + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: GroupedWithProratedMinimum ): T - fun visitNewSubscriptionBulkWithProration( - newSubscriptionBulkWithProration: NewSubscriptionBulkWithProrationPrice - ): T + fun visitBulkWithProration(bulkWithProration: BulkWithProration): T - fun visitNewSubscriptionScalableMatrixWithUnitPricing( - newSubscriptionScalableMatrixWithUnitPricing: - NewSubscriptionScalableMatrixWithUnitPricingPrice + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ): T - fun visitNewSubscriptionScalableMatrixWithTieredPricing( - newSubscriptionScalableMatrixWithTieredPricing: - NewSubscriptionScalableMatrixWithTieredPricingPrice + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ): T - fun visitNewSubscriptionCumulativeGroupedBulk( - newSubscriptionCumulativeGroupedBulk: NewSubscriptionCumulativeGroupedBulkPrice - ): T + fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T - fun visitNewSubscriptionMaxGroupTieredPackage( - newSubscriptionMaxGroupTieredPackage: NewSubscriptionMaxGroupTieredPackagePrice - ): T + fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T - fun visitNewSubscriptionGroupedWithMeteredMinimum( - newSubscriptionGroupedWithMeteredMinimum: - NewSubscriptionGroupedWithMeteredMinimumPrice + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: GroupedWithMeteredMinimum ): T - fun visitNewSubscriptionMatrixWithDisplayName( - newSubscriptionMatrixWithDisplayName: NewSubscriptionMatrixWithDisplayNamePrice - ): T + fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T - fun visitNewSubscriptionGroupedTieredPackage( - newSubscriptionGroupedTieredPackage: NewSubscriptionGroupedTieredPackagePrice - ): T + fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T /** * Maps an unknown variant of [Price] to a value of type [T]. @@ -68476,221 +67277,138 @@ private constructor( when (modelType) { "unit" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionUnit = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unit = it, _json = json) + } ?: Price(_json = json) } "package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(package_ = it, _json = json) + } ?: Price(_json = json) } "matrix" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionMatrix = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(matrix = it, _json = json) + } ?: Price(_json = json) } "tiered" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTiered = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tiered = it, _json = json) + } ?: Price(_json = json) } "tiered_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredBps = it, _json = json) + } ?: Price(_json = json) } "bps" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bps = it, _json = json) + } ?: Price(_json = json) } "bulk_bps" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkBps = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkBps = it, _json = json) + } ?: Price(_json = json) } "bulk" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(newSubscriptionBulk = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulk = it, _json = json) + } ?: Price(_json = json) } "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionThresholdTotalAmount = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(thresholdTotalAmount = it, _json = json) } + ?: Price(_json = json) } "tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredPackage = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredPackage = it, _json = json) + } ?: Price(_json = json) } "tiered_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTieredWithMinimum = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(tieredWithMinimum = it, _json = json) + } ?: Price(_json = json) } "unit_with_percent" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithPercent = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithPercent = it, _json = json) + } ?: Price(_json = json) } "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionPackageWithAllocation = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(packageWithAllocation = it, _json = json) } + ?: Price(_json = json) } "tiered_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionTierWithProration = it, _json = json) } + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(tieredWithProration = it, _json = json) } ?: Price(_json = json) } "unit_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionUnitWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(unitWithProration = it, _json = json) + } ?: Price(_json = json) } "grouped_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionGroupedAllocation = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(groupedAllocation = it, _json = json) + } ?: Price(_json = json) } "grouped_with_prorated_minimum" -> { return tryDeserialize( node, - jacksonTypeRef(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionGroupedWithProratedMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(groupedWithProratedMinimum = it, _json = json) } + ?: Price(_json = json) } "bulk_with_proration" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(newSubscriptionBulkWithProration = it, _json = json) } - ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Price(bulkWithProration = it, _json = json) + } ?: Price(_json = json) } "scalable_matrix_with_unit_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithUnitPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithUnitPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } + ?: Price(_json = json) } "scalable_matrix_with_tiered_pricing" -> { return tryDeserialize( node, - jacksonTypeRef< - NewSubscriptionScalableMatrixWithTieredPricingPrice - >(), + jacksonTypeRef(), ) - ?.let { - Price( - newSubscriptionScalableMatrixWithTieredPricing = it, - _json = json, - ) - } ?: Price(_json = json) + ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } + ?: Price(_json = json) } "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionCumulativeGroupedBulk = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(cumulativeGroupedBulk = it, _json = json) } + ?: Price(_json = json) } "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMaxGroupTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(maxGroupTieredPackage = it, _json = json) } + ?: Price(_json = json) } "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price( - newSubscriptionGroupedWithMeteredMinimum = it, - _json = json, - ) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } + ?: Price(_json = json) } "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionMatrixWithDisplayName = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(matrixWithDisplayName = it, _json = json) } + ?: Price(_json = json) } "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Price(newSubscriptionGroupedTieredPackage = it, _json = json) - } ?: Price(_json = json) + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Price(groupedTieredPackage = it, _json = json) } + ?: Price(_json = json) } } @@ -68706,67 +67424,54 @@ private constructor( provider: SerializerProvider, ) { when { - value.newSubscriptionUnit != null -> - generator.writeObject(value.newSubscriptionUnit) - value.newSubscriptionPackage != null -> - generator.writeObject(value.newSubscriptionPackage) - value.newSubscriptionMatrix != null -> - generator.writeObject(value.newSubscriptionMatrix) - value.newSubscriptionTiered != null -> - generator.writeObject(value.newSubscriptionTiered) - value.newSubscriptionTieredBps != null -> - generator.writeObject(value.newSubscriptionTieredBps) - value.newSubscriptionBps != null -> - generator.writeObject(value.newSubscriptionBps) - value.newSubscriptionBulkBps != null -> - generator.writeObject(value.newSubscriptionBulkBps) - value.newSubscriptionBulk != null -> - generator.writeObject(value.newSubscriptionBulk) - value.newSubscriptionThresholdTotalAmount != null -> - generator.writeObject(value.newSubscriptionThresholdTotalAmount) - value.newSubscriptionTieredPackage != null -> - generator.writeObject(value.newSubscriptionTieredPackage) - value.newSubscriptionTieredWithMinimum != null -> - generator.writeObject(value.newSubscriptionTieredWithMinimum) - value.newSubscriptionUnitWithPercent != null -> - generator.writeObject(value.newSubscriptionUnitWithPercent) - value.newSubscriptionPackageWithAllocation != null -> - generator.writeObject(value.newSubscriptionPackageWithAllocation) - value.newSubscriptionTierWithProration != null -> - generator.writeObject(value.newSubscriptionTierWithProration) - value.newSubscriptionUnitWithProration != null -> - generator.writeObject(value.newSubscriptionUnitWithProration) - value.newSubscriptionGroupedAllocation != null -> - generator.writeObject(value.newSubscriptionGroupedAllocation) - value.newSubscriptionGroupedWithProratedMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithProratedMinimum) - value.newSubscriptionBulkWithProration != null -> - generator.writeObject(value.newSubscriptionBulkWithProration) - value.newSubscriptionScalableMatrixWithUnitPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithUnitPricing - ) - value.newSubscriptionScalableMatrixWithTieredPricing != null -> - generator.writeObject( - value.newSubscriptionScalableMatrixWithTieredPricing - ) - value.newSubscriptionCumulativeGroupedBulk != null -> - generator.writeObject(value.newSubscriptionCumulativeGroupedBulk) - value.newSubscriptionMaxGroupTieredPackage != null -> - generator.writeObject(value.newSubscriptionMaxGroupTieredPackage) - value.newSubscriptionGroupedWithMeteredMinimum != null -> - generator.writeObject(value.newSubscriptionGroupedWithMeteredMinimum) - value.newSubscriptionMatrixWithDisplayName != null -> - generator.writeObject(value.newSubscriptionMatrixWithDisplayName) - value.newSubscriptionGroupedTieredPackage != null -> - generator.writeObject(value.newSubscriptionGroupedTieredPackage) + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.unitWithPercent != null -> + generator.writeObject(value.unitWithPercent) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } } } - class NewSubscriptionUnitPrice + class Unit private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -69172,8 +67877,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitPrice]. + * Returns a mutable builder for constructing an instance of [Unit]. * * The following fields are required: * ```java @@ -69186,7 +67890,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitPrice]. */ + /** A builder for [Unit]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -69211,27 +67915,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - cadence = newSubscriptionUnitPrice.cadence - itemId = newSubscriptionUnitPrice.itemId - modelType = newSubscriptionUnitPrice.modelType - name = newSubscriptionUnitPrice.name - unitConfig = newSubscriptionUnitPrice.unitConfig - billableMetricId = newSubscriptionUnitPrice.billableMetricId - billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitPrice.conversionRate - 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() + internal fun from(unit: Unit) = apply { + cadence = unit.cadence + itemId = unit.itemId + modelType = unit.modelType + name = unit.name + unitConfig = unit.unitConfig + billableMetricId = unit.billableMetricId + billedInAdvance = unit.billedInAdvance + billingCycleConfiguration = unit.billingCycleConfiguration + conversionRate = unit.conversionRate + currency = unit.currency + externalPriceId = unit.externalPriceId + fixedPriceQuantity = unit.fixedPriceQuantity + invoiceGroupingKey = unit.invoiceGroupingKey + invoicingCycleConfiguration = unit.invoicingCycleConfiguration + metadata = unit.metadata + referenceId = unit.referenceId + additionalProperties = unit.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -69604,7 +68305,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitPrice]. + * Returns an immutable instance of [Unit]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -69618,8 +68319,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitPrice = - NewSubscriptionUnitPrice( + fun build(): Unit = + Unit( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -69642,7 +68343,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitPrice = apply { + fun validate(): Unit = apply { if (validated) { return@apply } @@ -70871,7 +69572,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Unit && 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 */ @@ -70881,10 +69582,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Unit{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}" } - class NewSubscriptionPackagePrice + class Package private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -71290,8 +69991,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackagePrice]. + * Returns a mutable builder for constructing an instance of [Package]. * * The following fields are required: * ```java @@ -71304,7 +70004,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackagePrice]. */ + /** A builder for [Package]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -71329,29 +70029,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = - apply { - cadence = newSubscriptionPackagePrice.cadence - itemId = newSubscriptionPackagePrice.itemId - modelType = newSubscriptionPackagePrice.modelType - name = newSubscriptionPackagePrice.name - packageConfig = newSubscriptionPackagePrice.packageConfig - billableMetricId = newSubscriptionPackagePrice.billableMetricId - billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionPackagePrice.conversionRate - 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() - } + internal fun from(package_: Package) = apply { + cadence = package_.cadence + itemId = package_.itemId + modelType = package_.modelType + name = package_.name + packageConfig = package_.packageConfig + billableMetricId = package_.billableMetricId + billedInAdvance = package_.billedInAdvance + billingCycleConfiguration = package_.billingCycleConfiguration + conversionRate = package_.conversionRate + currency = package_.currency + externalPriceId = package_.externalPriceId + fixedPriceQuantity = package_.fixedPriceQuantity + invoiceGroupingKey = package_.invoiceGroupingKey + invoicingCycleConfiguration = package_.invoicingCycleConfiguration + metadata = package_.metadata + referenceId = package_.referenceId + additionalProperties = package_.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -71724,7 +70420,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackagePrice]. + * Returns an immutable instance of [Package]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -71738,8 +70434,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackagePrice = - NewSubscriptionPackagePrice( + fun build(): Package = + Package( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -71762,7 +70458,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackagePrice = apply { + fun validate(): Package = apply { if (validated) { return@apply } @@ -73042,7 +71738,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Package && 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 */ @@ -73052,10 +71748,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Package{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}" } - class NewSubscriptionMatrixPrice + class Matrix private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -73461,8 +72157,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixPrice]. + * Returns a mutable builder for constructing an instance of [Matrix]. * * The following fields are required: * ```java @@ -73475,7 +72170,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixPrice]. */ + /** A builder for [Matrix]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -73500,29 +72195,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = - apply { - cadence = newSubscriptionMatrixPrice.cadence - itemId = newSubscriptionMatrixPrice.itemId - matrixConfig = newSubscriptionMatrixPrice.matrixConfig - modelType = newSubscriptionMatrixPrice.modelType - name = newSubscriptionMatrixPrice.name - billableMetricId = newSubscriptionMatrixPrice.billableMetricId - billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixPrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixPrice.conversionRate - 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() - } + internal fun from(matrix: Matrix) = apply { + cadence = matrix.cadence + itemId = matrix.itemId + matrixConfig = matrix.matrixConfig + modelType = matrix.modelType + name = matrix.name + billableMetricId = matrix.billableMetricId + billedInAdvance = matrix.billedInAdvance + billingCycleConfiguration = matrix.billingCycleConfiguration + conversionRate = matrix.conversionRate + currency = matrix.currency + externalPriceId = matrix.externalPriceId + fixedPriceQuantity = matrix.fixedPriceQuantity + invoiceGroupingKey = matrix.invoiceGroupingKey + invoicingCycleConfiguration = matrix.invoicingCycleConfiguration + metadata = matrix.metadata + referenceId = matrix.referenceId + additionalProperties = matrix.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -73895,7 +72586,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixPrice]. + * Returns an immutable instance of [Matrix]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -73909,8 +72600,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixPrice = - NewSubscriptionMatrixPrice( + fun build(): Matrix = + Matrix( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired("matrixConfig", matrixConfig), @@ -73933,7 +72624,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixPrice = apply { + fun validate(): Matrix = apply { if (validated) { return@apply } @@ -75536,7 +74227,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Matrix && 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 */ @@ -75546,10 +74237,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Matrix{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}" } - class NewSubscriptionTieredPrice + class Tiered private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -75955,8 +74646,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPrice]. + * Returns a mutable builder for constructing an instance of [Tiered]. * * The following fields are required: * ```java @@ -75969,7 +74659,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPrice]. */ + /** A builder for [Tiered]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -75994,29 +74684,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = - apply { - cadence = newSubscriptionTieredPrice.cadence - itemId = newSubscriptionTieredPrice.itemId - modelType = newSubscriptionTieredPrice.modelType - name = newSubscriptionTieredPrice.name - tieredConfig = newSubscriptionTieredPrice.tieredConfig - billableMetricId = newSubscriptionTieredPrice.billableMetricId - billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPrice.conversionRate - 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() - } + internal fun from(tiered: Tiered) = apply { + cadence = tiered.cadence + itemId = tiered.itemId + modelType = tiered.modelType + name = tiered.name + tieredConfig = tiered.tieredConfig + billableMetricId = tiered.billableMetricId + billedInAdvance = tiered.billedInAdvance + billingCycleConfiguration = tiered.billingCycleConfiguration + conversionRate = tiered.conversionRate + currency = tiered.currency + externalPriceId = tiered.externalPriceId + fixedPriceQuantity = tiered.fixedPriceQuantity + invoiceGroupingKey = tiered.invoiceGroupingKey + invoicingCycleConfiguration = tiered.invoicingCycleConfiguration + metadata = tiered.metadata + referenceId = tiered.referenceId + additionalProperties = tiered.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -76389,7 +75075,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPrice]. + * Returns an immutable instance of [Tiered]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -76403,8 +75089,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPrice = - NewSubscriptionTieredPrice( + fun build(): Tiered = + Tiered( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -76427,7 +75113,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPrice = apply { + fun validate(): Tiered = apply { if (validated) { return@apply } @@ -77948,7 +76634,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Tiered && 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 */ @@ -77958,10 +76644,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Tiered{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}" } - class NewSubscriptionTieredBpsPrice + class TieredBps private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -78368,8 +77054,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredBpsPrice]. + * Returns a mutable builder for constructing an instance of [TieredBps]. * * The following fields are required: * ```java @@ -78382,7 +77067,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredBpsPrice]. */ + /** A builder for [TieredBps]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -78407,29 +77092,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice - ) = apply { - cadence = newSubscriptionTieredBpsPrice.cadence - itemId = newSubscriptionTieredBpsPrice.itemId - modelType = newSubscriptionTieredBpsPrice.modelType - name = newSubscriptionTieredBpsPrice.name - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig - billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredBpsPrice.conversionRate - 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() + internal fun from(tieredBps: TieredBps) = apply { + cadence = tieredBps.cadence + itemId = tieredBps.itemId + modelType = tieredBps.modelType + name = tieredBps.name + tieredBpsConfig = tieredBps.tieredBpsConfig + billableMetricId = tieredBps.billableMetricId + billedInAdvance = tieredBps.billedInAdvance + billingCycleConfiguration = tieredBps.billingCycleConfiguration + conversionRate = tieredBps.conversionRate + currency = tieredBps.currency + externalPriceId = tieredBps.externalPriceId + fixedPriceQuantity = tieredBps.fixedPriceQuantity + invoiceGroupingKey = tieredBps.invoiceGroupingKey + invoicingCycleConfiguration = tieredBps.invoicingCycleConfiguration + metadata = tieredBps.metadata + referenceId = tieredBps.referenceId + additionalProperties = tieredBps.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -78803,7 +77483,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredBpsPrice]. + * Returns an immutable instance of [TieredBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -78817,8 +77497,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredBpsPrice = - NewSubscriptionTieredBpsPrice( + fun build(): TieredBps = + TieredBps( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -78841,7 +77521,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredBpsPrice = apply { + fun validate(): TieredBps = apply { if (validated) { return@apply } @@ -80404,7 +79084,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredBps && 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 */ @@ -80414,10 +79094,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredBps{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}" } - class NewSubscriptionBpsPrice + class Bps private constructor( private val bpsConfig: JsonField, private val cadence: JsonField, @@ -80823,8 +79503,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBpsPrice]. + * Returns a mutable builder for constructing an instance of [Bps]. * * The following fields are required: * ```java @@ -80837,7 +79516,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBpsPrice]. */ + /** A builder for [Bps]. */ class Builder internal constructor() { private var bpsConfig: JsonField? = null @@ -80862,27 +79541,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - bpsConfig = newSubscriptionBpsPrice.bpsConfig - cadence = newSubscriptionBpsPrice.cadence - itemId = newSubscriptionBpsPrice.itemId - modelType = newSubscriptionBpsPrice.modelType - name = newSubscriptionBpsPrice.name - billableMetricId = newSubscriptionBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBpsPrice.conversionRate - 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() + internal fun from(bps: Bps) = apply { + bpsConfig = bps.bpsConfig + cadence = bps.cadence + itemId = bps.itemId + modelType = bps.modelType + name = bps.name + billableMetricId = bps.billableMetricId + billedInAdvance = bps.billedInAdvance + billingCycleConfiguration = bps.billingCycleConfiguration + conversionRate = bps.conversionRate + currency = bps.currency + externalPriceId = bps.externalPriceId + fixedPriceQuantity = bps.fixedPriceQuantity + invoiceGroupingKey = bps.invoiceGroupingKey + invoicingCycleConfiguration = bps.invoicingCycleConfiguration + metadata = bps.metadata + referenceId = bps.referenceId + additionalProperties = bps.additionalProperties.toMutableMap() } fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) @@ -81255,7 +79931,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBpsPrice]. + * Returns an immutable instance of [Bps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -81269,8 +79945,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBpsPrice = - NewSubscriptionBpsPrice( + fun build(): Bps = + Bps( checkRequired("bpsConfig", bpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -81293,7 +79969,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBpsPrice = apply { + fun validate(): Bps = apply { if (validated) { return@apply } @@ -82569,7 +81245,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bps && 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 */ @@ -82579,10 +81255,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bps{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}" } - class NewSubscriptionBulkBpsPrice + class BulkBps private constructor( private val bulkBpsConfig: JsonField, private val cadence: JsonField, @@ -82988,8 +81664,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkBpsPrice]. + * Returns a mutable builder for constructing an instance of [BulkBps]. * * The following fields are required: * ```java @@ -83002,7 +81677,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkBpsPrice]. */ + /** A builder for [BulkBps]. */ class Builder internal constructor() { private var bulkBpsConfig: JsonField? = null @@ -83027,29 +81702,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = - apply { - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig - cadence = newSubscriptionBulkBpsPrice.cadence - itemId = newSubscriptionBulkBpsPrice.itemId - modelType = newSubscriptionBulkBpsPrice.modelType - name = newSubscriptionBulkBpsPrice.name - billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkBpsPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkBpsPrice.conversionRate - 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() - } + internal fun from(bulkBps: BulkBps) = apply { + bulkBpsConfig = bulkBps.bulkBpsConfig + cadence = bulkBps.cadence + itemId = bulkBps.itemId + modelType = bulkBps.modelType + name = bulkBps.name + billableMetricId = bulkBps.billableMetricId + billedInAdvance = bulkBps.billedInAdvance + billingCycleConfiguration = bulkBps.billingCycleConfiguration + conversionRate = bulkBps.conversionRate + currency = bulkBps.currency + externalPriceId = bulkBps.externalPriceId + fixedPriceQuantity = bulkBps.fixedPriceQuantity + invoiceGroupingKey = bulkBps.invoiceGroupingKey + invoicingCycleConfiguration = bulkBps.invoicingCycleConfiguration + metadata = bulkBps.metadata + referenceId = bulkBps.referenceId + additionalProperties = bulkBps.additionalProperties.toMutableMap() + } fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = bulkBpsConfig(JsonField.of(bulkBpsConfig)) @@ -83422,7 +82093,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkBpsPrice]. + * Returns an immutable instance of [BulkBps]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -83436,8 +82107,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkBpsPrice = - NewSubscriptionBulkBpsPrice( + fun build(): BulkBps = + BulkBps( checkRequired("bulkBpsConfig", bulkBpsConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -83460,7 +82131,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkBpsPrice = apply { + fun validate(): BulkBps = apply { if (validated) { return@apply } @@ -84977,7 +83648,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkBps && 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 */ @@ -84987,10 +83658,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkBps{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}" } - class NewSubscriptionBulkPrice + class Bulk private constructor( private val bulkConfig: JsonField, private val cadence: JsonField, @@ -85396,8 +84067,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkPrice]. + * Returns a mutable builder for constructing an instance of [Bulk]. * * The following fields are required: * ```java @@ -85410,7 +84080,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkPrice]. */ + /** A builder for [Bulk]. */ class Builder internal constructor() { private var bulkConfig: JsonField? = null @@ -85435,27 +84105,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - bulkConfig = newSubscriptionBulkPrice.bulkConfig - cadence = newSubscriptionBulkPrice.cadence - itemId = newSubscriptionBulkPrice.itemId - modelType = newSubscriptionBulkPrice.modelType - name = newSubscriptionBulkPrice.name - billableMetricId = newSubscriptionBulkPrice.billableMetricId - billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkPrice.conversionRate - 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() + internal fun from(bulk: Bulk) = apply { + bulkConfig = bulk.bulkConfig + cadence = bulk.cadence + itemId = bulk.itemId + modelType = bulk.modelType + name = bulk.name + billableMetricId = bulk.billableMetricId + billedInAdvance = bulk.billedInAdvance + billingCycleConfiguration = bulk.billingCycleConfiguration + conversionRate = bulk.conversionRate + currency = bulk.currency + externalPriceId = bulk.externalPriceId + fixedPriceQuantity = bulk.fixedPriceQuantity + invoiceGroupingKey = bulk.invoiceGroupingKey + invoicingCycleConfiguration = bulk.invoicingCycleConfiguration + metadata = bulk.metadata + referenceId = bulk.referenceId + additionalProperties = bulk.additionalProperties.toMutableMap() } fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) @@ -85828,7 +84495,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkPrice]. + * Returns an immutable instance of [Bulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -85842,8 +84509,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkPrice = - NewSubscriptionBulkPrice( + fun build(): Bulk = + Bulk( checkRequired("bulkConfig", bulkConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -85866,7 +84533,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkPrice = apply { + fun validate(): Bulk = apply { if (validated) { return@apply } @@ -87341,7 +86008,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Bulk && 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 */ @@ -87351,10 +86018,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "Bulk{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}" } - class NewSubscriptionThresholdTotalAmountPrice + class ThresholdTotalAmount private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -87764,7 +86431,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionThresholdTotalAmountPrice]. + * [ThresholdTotalAmount]. * * The following fields are required: * ```java @@ -87777,7 +86444,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionThresholdTotalAmountPrice]. */ + /** A builder for [ThresholdTotalAmount]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -87803,34 +86470,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionThresholdTotalAmountPrice: - NewSubscriptionThresholdTotalAmountPrice - ) = apply { - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - itemId = newSubscriptionThresholdTotalAmountPrice.itemId - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - name = newSubscriptionThresholdTotalAmountPrice.name - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - currency = newSubscriptionThresholdTotalAmountPrice.currency - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey + internal fun from(thresholdTotalAmount: ThresholdTotalAmount) = apply { + cadence = thresholdTotalAmount.cadence + itemId = thresholdTotalAmount.itemId + modelType = thresholdTotalAmount.modelType + name = thresholdTotalAmount.name + thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig + billableMetricId = thresholdTotalAmount.billableMetricId + billedInAdvance = thresholdTotalAmount.billedInAdvance + billingCycleConfiguration = thresholdTotalAmount.billingCycleConfiguration + conversionRate = thresholdTotalAmount.conversionRate + currency = thresholdTotalAmount.currency + externalPriceId = thresholdTotalAmount.externalPriceId + fixedPriceQuantity = thresholdTotalAmount.fixedPriceQuantity + invoiceGroupingKey = thresholdTotalAmount.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId + thresholdTotalAmount.invoicingCycleConfiguration + metadata = thresholdTotalAmount.metadata + referenceId = thresholdTotalAmount.referenceId additionalProperties = - newSubscriptionThresholdTotalAmountPrice.additionalProperties - .toMutableMap() + thresholdTotalAmount.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -88206,7 +86865,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionThresholdTotalAmountPrice]. + * Returns an immutable instance of [ThresholdTotalAmount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -88220,8 +86879,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionThresholdTotalAmountPrice = - NewSubscriptionThresholdTotalAmountPrice( + fun build(): ThresholdTotalAmount = + ThresholdTotalAmount( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -88244,7 +86903,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionThresholdTotalAmountPrice = apply { + fun validate(): ThresholdTotalAmount = apply { if (validated) { return@apply } @@ -89418,7 +88077,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is ThresholdTotalAmount && 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 */ @@ -89428,10 +88087,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "ThresholdTotalAmount{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}" } - class NewSubscriptionTieredPackagePrice + class TieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -89838,8 +88497,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredPackagePrice]. + * Returns a mutable builder for constructing an instance of [TieredPackage]. * * The following fields are required: * ```java @@ -89852,7 +88510,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredPackagePrice]. */ + /** A builder for [TieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -89877,29 +88535,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice - ) = apply { - cadence = newSubscriptionTieredPackagePrice.cadence - itemId = newSubscriptionTieredPackagePrice.itemId - modelType = newSubscriptionTieredPackagePrice.modelType - name = newSubscriptionTieredPackagePrice.name - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig - billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredPackagePrice.conversionRate - 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() + internal fun from(tieredPackage: TieredPackage) = apply { + cadence = tieredPackage.cadence + itemId = tieredPackage.itemId + modelType = tieredPackage.modelType + name = tieredPackage.name + tieredPackageConfig = tieredPackage.tieredPackageConfig + billableMetricId = tieredPackage.billableMetricId + billedInAdvance = tieredPackage.billedInAdvance + billingCycleConfiguration = tieredPackage.billingCycleConfiguration + conversionRate = tieredPackage.conversionRate + currency = tieredPackage.currency + externalPriceId = tieredPackage.externalPriceId + fixedPriceQuantity = tieredPackage.fixedPriceQuantity + invoiceGroupingKey = tieredPackage.invoiceGroupingKey + invoicingCycleConfiguration = tieredPackage.invoicingCycleConfiguration + metadata = tieredPackage.metadata + referenceId = tieredPackage.referenceId + additionalProperties = tieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -90274,7 +88927,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredPackagePrice]. + * Returns an immutable instance of [TieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -90288,8 +88941,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredPackagePrice = - NewSubscriptionTieredPackagePrice( + fun build(): TieredPackage = + TieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -90312,7 +88965,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredPackagePrice = apply { + fun validate(): TieredPackage = apply { if (validated) { return@apply } @@ -91483,7 +90136,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredPackage && 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 */ @@ -91493,10 +90146,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredPackage{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}" } - class NewSubscriptionTieredWithMinimumPrice + class TieredWithMinimum private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -91905,7 +90558,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTieredWithMinimumPrice]. + * [TieredWithMinimum]. * * The following fields are required: * ```java @@ -91918,7 +90571,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTieredWithMinimumPrice]. */ + /** A builder for [TieredWithMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -91943,33 +90596,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice - ) = apply { - cadence = newSubscriptionTieredWithMinimumPrice.cadence - itemId = newSubscriptionTieredWithMinimumPrice.itemId - modelType = newSubscriptionTieredWithMinimumPrice.modelType - name = newSubscriptionTieredWithMinimumPrice.name - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - currency = newSubscriptionTieredWithMinimumPrice.currency - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - metadata = newSubscriptionTieredWithMinimumPrice.metadata - referenceId = newSubscriptionTieredWithMinimumPrice.referenceId - additionalProperties = - newSubscriptionTieredWithMinimumPrice.additionalProperties - .toMutableMap() + internal fun from(tieredWithMinimum: TieredWithMinimum) = apply { + cadence = tieredWithMinimum.cadence + itemId = tieredWithMinimum.itemId + modelType = tieredWithMinimum.modelType + name = tieredWithMinimum.name + tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig + billableMetricId = tieredWithMinimum.billableMetricId + billedInAdvance = tieredWithMinimum.billedInAdvance + billingCycleConfiguration = tieredWithMinimum.billingCycleConfiguration + conversionRate = tieredWithMinimum.conversionRate + currency = tieredWithMinimum.currency + externalPriceId = tieredWithMinimum.externalPriceId + fixedPriceQuantity = tieredWithMinimum.fixedPriceQuantity + invoiceGroupingKey = tieredWithMinimum.invoiceGroupingKey + invoicingCycleConfiguration = tieredWithMinimum.invoicingCycleConfiguration + metadata = tieredWithMinimum.metadata + referenceId = tieredWithMinimum.referenceId + additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -92343,7 +90987,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTieredWithMinimumPrice]. + * Returns an immutable instance of [TieredWithMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -92357,8 +91001,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTieredWithMinimumPrice = - NewSubscriptionTieredWithMinimumPrice( + fun build(): TieredWithMinimum = + TieredWithMinimum( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -92381,7 +91025,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTieredWithMinimumPrice = apply { + fun validate(): TieredWithMinimum = apply { if (validated) { return@apply } @@ -93555,7 +92199,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithMinimum && 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 */ @@ -93565,10 +92209,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithMinimum{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}" } - class NewSubscriptionUnitWithPercentPrice + class UnitWithPercent private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -93976,8 +92620,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithPercentPrice]. + * Returns a mutable builder for constructing an instance of [UnitWithPercent]. * * The following fields are required: * ```java @@ -93990,7 +92633,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithPercentPrice]. */ + /** A builder for [UnitWithPercent]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -94015,30 +92658,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice - ) = apply { - cadence = newSubscriptionUnitWithPercentPrice.cadence - itemId = newSubscriptionUnitWithPercentPrice.itemId - modelType = newSubscriptionUnitWithPercentPrice.modelType - name = newSubscriptionUnitWithPercentPrice.name - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig - billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - 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() + internal fun from(unitWithPercent: UnitWithPercent) = apply { + cadence = unitWithPercent.cadence + itemId = unitWithPercent.itemId + modelType = unitWithPercent.modelType + name = unitWithPercent.name + unitWithPercentConfig = unitWithPercent.unitWithPercentConfig + billableMetricId = unitWithPercent.billableMetricId + billedInAdvance = unitWithPercent.billedInAdvance + billingCycleConfiguration = unitWithPercent.billingCycleConfiguration + conversionRate = unitWithPercent.conversionRate + currency = unitWithPercent.currency + externalPriceId = unitWithPercent.externalPriceId + fixedPriceQuantity = unitWithPercent.fixedPriceQuantity + invoiceGroupingKey = unitWithPercent.invoiceGroupingKey + invoicingCycleConfiguration = unitWithPercent.invoicingCycleConfiguration + metadata = unitWithPercent.metadata + referenceId = unitWithPercent.referenceId + additionalProperties = unitWithPercent.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -94412,7 +93049,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithPercentPrice]. + * Returns an immutable instance of [UnitWithPercent]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -94426,8 +93063,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithPercentPrice = - NewSubscriptionUnitWithPercentPrice( + fun build(): UnitWithPercent = + UnitWithPercent( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -94450,7 +93087,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithPercentPrice = apply { + fun validate(): UnitWithPercent = apply { if (validated) { return@apply } @@ -95621,7 +94258,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithPercent && 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 */ @@ -95631,10 +94268,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithPercent{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}" } - class NewSubscriptionPackageWithAllocationPrice + class PackageWithAllocation private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -96044,7 +94681,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionPackageWithAllocationPrice]. + * [PackageWithAllocation]. * * The following fields are required: * ```java @@ -96057,7 +94694,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionPackageWithAllocationPrice]. */ + /** A builder for [PackageWithAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -96084,35 +94721,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionPackageWithAllocationPrice: - NewSubscriptionPackageWithAllocationPrice - ) = apply { - cadence = newSubscriptionPackageWithAllocationPrice.cadence - itemId = newSubscriptionPackageWithAllocationPrice.itemId - modelType = newSubscriptionPackageWithAllocationPrice.modelType - name = newSubscriptionPackageWithAllocationPrice.name + internal fun from(packageWithAllocation: PackageWithAllocation) = apply { + cadence = packageWithAllocation.cadence + itemId = packageWithAllocation.itemId + modelType = packageWithAllocation.modelType + name = packageWithAllocation.name packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - billableMetricId = - newSubscriptionPackageWithAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - currency = newSubscriptionPackageWithAllocationPrice.currency - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey + packageWithAllocation.packageWithAllocationConfig + billableMetricId = packageWithAllocation.billableMetricId + billedInAdvance = packageWithAllocation.billedInAdvance + billingCycleConfiguration = packageWithAllocation.billingCycleConfiguration + conversionRate = packageWithAllocation.conversionRate + currency = packageWithAllocation.currency + externalPriceId = packageWithAllocation.externalPriceId + fixedPriceQuantity = packageWithAllocation.fixedPriceQuantity + invoiceGroupingKey = packageWithAllocation.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionPackageWithAllocationPrice.metadata - referenceId = newSubscriptionPackageWithAllocationPrice.referenceId + packageWithAllocation.invoicingCycleConfiguration + metadata = packageWithAllocation.metadata + referenceId = packageWithAllocation.referenceId additionalProperties = - newSubscriptionPackageWithAllocationPrice.additionalProperties - .toMutableMap() + packageWithAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -96488,7 +95117,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionPackageWithAllocationPrice]. + * Returns an immutable instance of [PackageWithAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -96502,8 +95131,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionPackageWithAllocationPrice = - NewSubscriptionPackageWithAllocationPrice( + fun build(): PackageWithAllocation = + PackageWithAllocation( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -96529,7 +95158,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionPackageWithAllocationPrice = apply { + fun validate(): PackageWithAllocation = apply { if (validated) { return@apply } @@ -97704,7 +96333,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is PackageWithAllocation && 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 */ @@ -97714,10 +96343,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "PackageWithAllocation{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}" } - class NewSubscriptionTierWithProrationPrice + class TieredWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -98127,7 +96756,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionTierWithProrationPrice]. + * [TieredWithProration]. * * The following fields are required: * ```java @@ -98140,7 +96769,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionTierWithProrationPrice]. */ + /** A builder for [TieredWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -98166,33 +96795,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice - ) = apply { - cadence = newSubscriptionTierWithProrationPrice.cadence - itemId = newSubscriptionTierWithProrationPrice.itemId - modelType = newSubscriptionTierWithProrationPrice.modelType - name = newSubscriptionTierWithProrationPrice.name - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - currency = newSubscriptionTierWithProrationPrice.currency - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionTierWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionTierWithProrationPrice.invoiceGroupingKey + internal fun from(tieredWithProration: TieredWithProration) = apply { + cadence = tieredWithProration.cadence + itemId = tieredWithProration.itemId + modelType = tieredWithProration.modelType + name = tieredWithProration.name + tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig + billableMetricId = tieredWithProration.billableMetricId + billedInAdvance = tieredWithProration.billedInAdvance + billingCycleConfiguration = tieredWithProration.billingCycleConfiguration + conversionRate = tieredWithProration.conversionRate + currency = tieredWithProration.currency + externalPriceId = tieredWithProration.externalPriceId + fixedPriceQuantity = tieredWithProration.fixedPriceQuantity + invoiceGroupingKey = tieredWithProration.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionTierWithProrationPrice.metadata - referenceId = newSubscriptionTierWithProrationPrice.referenceId + tieredWithProration.invoicingCycleConfiguration + metadata = tieredWithProration.metadata + referenceId = tieredWithProration.referenceId additionalProperties = - newSubscriptionTierWithProrationPrice.additionalProperties - .toMutableMap() + tieredWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -98567,7 +97189,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionTierWithProrationPrice]. + * Returns an immutable instance of [TieredWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -98581,8 +97203,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionTierWithProrationPrice = - NewSubscriptionTierWithProrationPrice( + fun build(): TieredWithProration = + TieredWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -98605,7 +97227,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionTierWithProrationPrice = apply { + fun validate(): TieredWithProration = apply { if (validated) { return@apply } @@ -99779,7 +98401,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is TieredWithProration && 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 */ @@ -99789,10 +98411,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "TieredWithProration{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}" } - class NewSubscriptionUnitWithProrationPrice + class UnitWithProration private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -100201,7 +98823,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionUnitWithProrationPrice]. + * [UnitWithProration]. * * The following fields are required: * ```java @@ -100214,7 +98836,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionUnitWithProrationPrice]. */ + /** A builder for [UnitWithProration]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -100239,33 +98861,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice - ) = apply { - cadence = newSubscriptionUnitWithProrationPrice.cadence - itemId = newSubscriptionUnitWithProrationPrice.itemId - modelType = newSubscriptionUnitWithProrationPrice.modelType - name = newSubscriptionUnitWithProrationPrice.name - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - currency = newSubscriptionUnitWithProrationPrice.currency - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionUnitWithProrationPrice.metadata - referenceId = newSubscriptionUnitWithProrationPrice.referenceId - additionalProperties = - newSubscriptionUnitWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(unitWithProration: UnitWithProration) = apply { + cadence = unitWithProration.cadence + itemId = unitWithProration.itemId + modelType = unitWithProration.modelType + name = unitWithProration.name + unitWithProrationConfig = unitWithProration.unitWithProrationConfig + billableMetricId = unitWithProration.billableMetricId + billedInAdvance = unitWithProration.billedInAdvance + billingCycleConfiguration = unitWithProration.billingCycleConfiguration + conversionRate = unitWithProration.conversionRate + currency = unitWithProration.currency + externalPriceId = unitWithProration.externalPriceId + fixedPriceQuantity = unitWithProration.fixedPriceQuantity + invoiceGroupingKey = unitWithProration.invoiceGroupingKey + invoicingCycleConfiguration = unitWithProration.invoicingCycleConfiguration + metadata = unitWithProration.metadata + referenceId = unitWithProration.referenceId + additionalProperties = unitWithProration.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -100639,7 +99252,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionUnitWithProrationPrice]. + * Returns an immutable instance of [UnitWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -100653,8 +99266,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionUnitWithProrationPrice = - NewSubscriptionUnitWithProrationPrice( + fun build(): UnitWithProration = + UnitWithProration( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -100677,7 +99290,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionUnitWithProrationPrice = apply { + fun validate(): UnitWithProration = apply { if (validated) { return@apply } @@ -101851,7 +100464,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is UnitWithProration && 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 */ @@ -101861,10 +100474,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "UnitWithProration{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}" } - class NewSubscriptionGroupedAllocationPrice + class GroupedAllocation private constructor( private val cadence: JsonField, private val groupedAllocationConfig: JsonField, @@ -102273,7 +100886,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedAllocationPrice]. + * [GroupedAllocation]. * * The following fields are required: * ```java @@ -102286,7 +100899,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedAllocationPrice]. */ + /** A builder for [GroupedAllocation]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -102311,33 +100924,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice - ) = apply { - cadence = newSubscriptionGroupedAllocationPrice.cadence - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - itemId = newSubscriptionGroupedAllocationPrice.itemId - modelType = newSubscriptionGroupedAllocationPrice.modelType - name = newSubscriptionGroupedAllocationPrice.name - billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - currency = newSubscriptionGroupedAllocationPrice.currency - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedAllocationPrice.metadata - referenceId = newSubscriptionGroupedAllocationPrice.referenceId - additionalProperties = - newSubscriptionGroupedAllocationPrice.additionalProperties - .toMutableMap() + internal fun from(groupedAllocation: GroupedAllocation) = apply { + cadence = groupedAllocation.cadence + groupedAllocationConfig = groupedAllocation.groupedAllocationConfig + itemId = groupedAllocation.itemId + modelType = groupedAllocation.modelType + name = groupedAllocation.name + billableMetricId = groupedAllocation.billableMetricId + billedInAdvance = groupedAllocation.billedInAdvance + billingCycleConfiguration = groupedAllocation.billingCycleConfiguration + conversionRate = groupedAllocation.conversionRate + currency = groupedAllocation.currency + externalPriceId = groupedAllocation.externalPriceId + fixedPriceQuantity = groupedAllocation.fixedPriceQuantity + invoiceGroupingKey = groupedAllocation.invoiceGroupingKey + invoicingCycleConfiguration = groupedAllocation.invoicingCycleConfiguration + metadata = groupedAllocation.metadata + referenceId = groupedAllocation.referenceId + additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -102711,7 +101315,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedAllocationPrice]. + * Returns an immutable instance of [GroupedAllocation]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -102725,8 +101329,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedAllocationPrice = - NewSubscriptionGroupedAllocationPrice( + fun build(): GroupedAllocation = + GroupedAllocation( checkRequired("cadence", cadence), checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("itemId", itemId), @@ -102749,7 +101353,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedAllocationPrice = apply { + fun validate(): GroupedAllocation = apply { if (validated) { return@apply } @@ -103921,7 +102525,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedAllocation && 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 */ @@ -103931,10 +102535,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedAllocation{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}" } - class NewSubscriptionGroupedWithProratedMinimumPrice + class GroupedWithProratedMinimum private constructor( private val cadence: JsonField, private val groupedWithProratedMinimumConfig: @@ -104347,7 +102951,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * [GroupedWithProratedMinimum]. * * The following fields are required: * ```java @@ -104360,7 +102964,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithProratedMinimumPrice]. */ + /** A builder for [GroupedWithProratedMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -104388,41 +102992,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithProratedMinimumPrice: - NewSubscriptionGroupedWithProratedMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - name = newSubscriptionGroupedWithProratedMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithProratedMinimum: GroupedWithProratedMinimum) = + apply { + cadence = groupedWithProratedMinimum.cadence + groupedWithProratedMinimumConfig = + groupedWithProratedMinimum.groupedWithProratedMinimumConfig + itemId = groupedWithProratedMinimum.itemId + modelType = groupedWithProratedMinimum.modelType + name = groupedWithProratedMinimum.name + billableMetricId = groupedWithProratedMinimum.billableMetricId + billedInAdvance = groupedWithProratedMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithProratedMinimum.billingCycleConfiguration + conversionRate = groupedWithProratedMinimum.conversionRate + currency = groupedWithProratedMinimum.currency + externalPriceId = groupedWithProratedMinimum.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithProratedMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithProratedMinimum.invoicingCycleConfiguration + metadata = groupedWithProratedMinimum.metadata + referenceId = groupedWithProratedMinimum.referenceId + additionalProperties = + groupedWithProratedMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -104803,8 +103396,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithProratedMinimumPrice]. + * Returns an immutable instance of [GroupedWithProratedMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -104818,8 +103410,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = - NewSubscriptionGroupedWithProratedMinimumPrice( + fun build(): GroupedWithProratedMinimum = + GroupedWithProratedMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", @@ -104845,7 +103437,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithProratedMinimum = apply { if (validated) { return@apply } @@ -106020,7 +104612,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is GroupedWithProratedMinimum && 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 */ @@ -106030,10 +104622,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "GroupedWithProratedMinimum{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}" } - class NewSubscriptionBulkWithProrationPrice + class BulkWithProration private constructor( private val bulkWithProrationConfig: JsonField, private val cadence: JsonField, @@ -106442,7 +105034,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionBulkWithProrationPrice]. + * [BulkWithProration]. * * The following fields are required: * ```java @@ -106455,7 +105047,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionBulkWithProrationPrice]. */ + /** A builder for [BulkWithProration]. */ class Builder internal constructor() { private var bulkWithProrationConfig: JsonField? = null @@ -106480,33 +105072,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice - ) = apply { - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - cadence = newSubscriptionBulkWithProrationPrice.cadence - itemId = newSubscriptionBulkWithProrationPrice.itemId - modelType = newSubscriptionBulkWithProrationPrice.modelType - name = newSubscriptionBulkWithProrationPrice.name - billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - currency = newSubscriptionBulkWithProrationPrice.currency - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - metadata = newSubscriptionBulkWithProrationPrice.metadata - referenceId = newSubscriptionBulkWithProrationPrice.referenceId - additionalProperties = - newSubscriptionBulkWithProrationPrice.additionalProperties - .toMutableMap() + internal fun from(bulkWithProration: BulkWithProration) = apply { + bulkWithProrationConfig = bulkWithProration.bulkWithProrationConfig + cadence = bulkWithProration.cadence + itemId = bulkWithProration.itemId + modelType = bulkWithProration.modelType + name = bulkWithProration.name + billableMetricId = bulkWithProration.billableMetricId + billedInAdvance = bulkWithProration.billedInAdvance + billingCycleConfiguration = bulkWithProration.billingCycleConfiguration + conversionRate = bulkWithProration.conversionRate + currency = bulkWithProration.currency + externalPriceId = bulkWithProration.externalPriceId + fixedPriceQuantity = bulkWithProration.fixedPriceQuantity + invoiceGroupingKey = bulkWithProration.invoiceGroupingKey + invoicingCycleConfiguration = bulkWithProration.invoicingCycleConfiguration + metadata = bulkWithProration.metadata + referenceId = bulkWithProration.referenceId + additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = @@ -106880,7 +105463,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionBulkWithProrationPrice]. + * Returns an immutable instance of [BulkWithProration]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -106894,8 +105477,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionBulkWithProrationPrice = - NewSubscriptionBulkWithProrationPrice( + fun build(): BulkWithProration = + BulkWithProration( checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("itemId", itemId), @@ -106918,7 +105501,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionBulkWithProrationPrice = apply { + fun validate(): BulkWithProration = apply { if (validated) { return@apply } @@ -108092,7 +106675,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is BulkWithProration && 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 */ @@ -108102,10 +106685,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "BulkWithProration{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}" } - class NewSubscriptionScalableMatrixWithUnitPricingPrice + class ScalableMatrixWithUnitPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -108520,7 +107103,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * [ScalableMatrixWithUnitPricing]. * * The following fields are required: * ```java @@ -108533,7 +107116,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithUnitPricingPrice]. */ + /** A builder for [ScalableMatrixWithUnitPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -108562,40 +107145,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithUnitPricingPrice: - NewSubscriptionScalableMatrixWithUnitPricingPrice + scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithUnitPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithUnitPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithUnitPricingPrice.modelType - name = newSubscriptionScalableMatrixWithUnitPricingPrice.name + cadence = scalableMatrixWithUnitPricing.cadence + itemId = scalableMatrixWithUnitPricing.itemId + modelType = scalableMatrixWithUnitPricing.modelType + name = scalableMatrixWithUnitPricing.name scalableMatrixWithUnitPricingConfig = - newSubscriptionScalableMatrixWithUnitPricingPrice - .scalableMatrixWithUnitPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithUnitPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithUnitPricingPrice.billedInAdvance + scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig + billableMetricId = scalableMatrixWithUnitPricing.billableMetricId + billedInAdvance = scalableMatrixWithUnitPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithUnitPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithUnitPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithUnitPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithUnitPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithUnitPricingPrice.invoiceGroupingKey + scalableMatrixWithUnitPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithUnitPricing.conversionRate + currency = scalableMatrixWithUnitPricing.currency + externalPriceId = scalableMatrixWithUnitPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithUnitPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithUnitPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithUnitPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithUnitPricingPrice.metadata - referenceId = newSubscriptionScalableMatrixWithUnitPricingPrice.referenceId + scalableMatrixWithUnitPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithUnitPricing.metadata + referenceId = scalableMatrixWithUnitPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithUnitPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithUnitPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -108979,8 +107551,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithUnitPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithUnitPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -108994,8 +107565,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithUnitPricingPrice = - NewSubscriptionScalableMatrixWithUnitPricingPrice( + fun build(): ScalableMatrixWithUnitPricing = + ScalableMatrixWithUnitPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -109021,7 +107592,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithUnitPricingPrice = apply { + fun validate(): ScalableMatrixWithUnitPricing = apply { if (validated) { return@apply } @@ -110198,7 +108769,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && 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 */ @@ -110208,10 +108779,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionScalableMatrixWithTieredPricingPrice + class ScalableMatrixWithTieredPricing private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -110626,7 +109197,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * [ScalableMatrixWithTieredPricing]. * * The following fields are required: * ```java @@ -110639,7 +109210,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionScalableMatrixWithTieredPricingPrice]. */ + /** A builder for [ScalableMatrixWithTieredPricing]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -110668,41 +109239,29 @@ private constructor( @JvmSynthetic internal fun from( - newSubscriptionScalableMatrixWithTieredPricingPrice: - NewSubscriptionScalableMatrixWithTieredPricingPrice + scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing ) = apply { - cadence = newSubscriptionScalableMatrixWithTieredPricingPrice.cadence - itemId = newSubscriptionScalableMatrixWithTieredPricingPrice.itemId - modelType = newSubscriptionScalableMatrixWithTieredPricingPrice.modelType - name = newSubscriptionScalableMatrixWithTieredPricingPrice.name + cadence = scalableMatrixWithTieredPricing.cadence + itemId = scalableMatrixWithTieredPricing.itemId + modelType = scalableMatrixWithTieredPricing.modelType + name = scalableMatrixWithTieredPricing.name scalableMatrixWithTieredPricingConfig = - newSubscriptionScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = - newSubscriptionScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = - newSubscriptionScalableMatrixWithTieredPricingPrice.billedInAdvance + scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig + billableMetricId = scalableMatrixWithTieredPricing.billableMetricId + billedInAdvance = scalableMatrixWithTieredPricing.billedInAdvance billingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .billingCycleConfiguration - conversionRate = - newSubscriptionScalableMatrixWithTieredPricingPrice.conversionRate - currency = newSubscriptionScalableMatrixWithTieredPricingPrice.currency - externalPriceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + scalableMatrixWithTieredPricing.billingCycleConfiguration + conversionRate = scalableMatrixWithTieredPricing.conversionRate + currency = scalableMatrixWithTieredPricing.currency + externalPriceId = scalableMatrixWithTieredPricing.externalPriceId + fixedPriceQuantity = scalableMatrixWithTieredPricing.fixedPriceQuantity + invoiceGroupingKey = scalableMatrixWithTieredPricing.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionScalableMatrixWithTieredPricingPrice - .invoicingCycleConfiguration - metadata = newSubscriptionScalableMatrixWithTieredPricingPrice.metadata - referenceId = - newSubscriptionScalableMatrixWithTieredPricingPrice.referenceId + scalableMatrixWithTieredPricing.invoicingCycleConfiguration + metadata = scalableMatrixWithTieredPricing.metadata + referenceId = scalableMatrixWithTieredPricing.referenceId additionalProperties = - newSubscriptionScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() + scalableMatrixWithTieredPricing.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -111086,8 +109645,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionScalableMatrixWithTieredPricingPrice]. + * Returns an immutable instance of [ScalableMatrixWithTieredPricing]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -111101,8 +109659,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionScalableMatrixWithTieredPricingPrice = - NewSubscriptionScalableMatrixWithTieredPricingPrice( + fun build(): ScalableMatrixWithTieredPricing = + ScalableMatrixWithTieredPricing( checkRequired("cadence", cadence), checkRequired("itemId", itemId), modelType, @@ -111128,7 +109686,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionScalableMatrixWithTieredPricingPrice = apply { + fun validate(): ScalableMatrixWithTieredPricing = apply { if (validated) { return@apply } @@ -112309,7 +110867,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && 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 */ @@ -112319,10 +110877,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionCumulativeGroupedBulkPrice + class CumulativeGroupedBulk private constructor( private val cadence: JsonField, private val cumulativeGroupedBulkConfig: JsonField, @@ -112732,7 +111290,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionCumulativeGroupedBulkPrice]. + * [CumulativeGroupedBulk]. * * The following fields are required: * ```java @@ -112745,7 +111303,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionCumulativeGroupedBulkPrice]. */ + /** A builder for [CumulativeGroupedBulk]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -112772,35 +111330,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionCumulativeGroupedBulkPrice: - NewSubscriptionCumulativeGroupedBulkPrice - ) = apply { - cadence = newSubscriptionCumulativeGroupedBulkPrice.cadence + internal fun from(cumulativeGroupedBulk: CumulativeGroupedBulk) = apply { + cadence = cumulativeGroupedBulk.cadence cumulativeGroupedBulkConfig = - newSubscriptionCumulativeGroupedBulkPrice.cumulativeGroupedBulkConfig - itemId = newSubscriptionCumulativeGroupedBulkPrice.itemId - modelType = newSubscriptionCumulativeGroupedBulkPrice.modelType - name = newSubscriptionCumulativeGroupedBulkPrice.name - billableMetricId = - newSubscriptionCumulativeGroupedBulkPrice.billableMetricId - billedInAdvance = newSubscriptionCumulativeGroupedBulkPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.billingCycleConfiguration - conversionRate = newSubscriptionCumulativeGroupedBulkPrice.conversionRate - currency = newSubscriptionCumulativeGroupedBulkPrice.currency - externalPriceId = newSubscriptionCumulativeGroupedBulkPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionCumulativeGroupedBulkPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionCumulativeGroupedBulkPrice.invoiceGroupingKey + cumulativeGroupedBulk.cumulativeGroupedBulkConfig + itemId = cumulativeGroupedBulk.itemId + modelType = cumulativeGroupedBulk.modelType + name = cumulativeGroupedBulk.name + billableMetricId = cumulativeGroupedBulk.billableMetricId + billedInAdvance = cumulativeGroupedBulk.billedInAdvance + billingCycleConfiguration = cumulativeGroupedBulk.billingCycleConfiguration + conversionRate = cumulativeGroupedBulk.conversionRate + currency = cumulativeGroupedBulk.currency + externalPriceId = cumulativeGroupedBulk.externalPriceId + fixedPriceQuantity = cumulativeGroupedBulk.fixedPriceQuantity + invoiceGroupingKey = cumulativeGroupedBulk.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionCumulativeGroupedBulkPrice.invoicingCycleConfiguration - metadata = newSubscriptionCumulativeGroupedBulkPrice.metadata - referenceId = newSubscriptionCumulativeGroupedBulkPrice.referenceId + cumulativeGroupedBulk.invoicingCycleConfiguration + metadata = cumulativeGroupedBulk.metadata + referenceId = cumulativeGroupedBulk.referenceId additionalProperties = - newSubscriptionCumulativeGroupedBulkPrice.additionalProperties - .toMutableMap() + cumulativeGroupedBulk.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -113176,7 +111726,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionCumulativeGroupedBulkPrice]. + * Returns an immutable instance of [CumulativeGroupedBulk]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -113190,8 +111740,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionCumulativeGroupedBulkPrice = - NewSubscriptionCumulativeGroupedBulkPrice( + fun build(): CumulativeGroupedBulk = + CumulativeGroupedBulk( checkRequired("cadence", cadence), checkRequired( "cumulativeGroupedBulkConfig", @@ -113217,7 +111767,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionCumulativeGroupedBulkPrice = apply { + fun validate(): CumulativeGroupedBulk = apply { if (validated) { return@apply } @@ -114392,7 +112942,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ + return /* spotless:off */ other is CumulativeGroupedBulk && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && 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 */ @@ -114402,10 +112952,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" + "CumulativeGroupedBulk{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, 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}" } - class NewSubscriptionMaxGroupTieredPackagePrice + class MaxGroupTieredPackage private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -114815,7 +113365,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMaxGroupTieredPackagePrice]. + * [MaxGroupTieredPackage]. * * The following fields are required: * ```java @@ -114828,7 +113378,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMaxGroupTieredPackagePrice]. */ + /** A builder for [MaxGroupTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -114855,35 +113405,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMaxGroupTieredPackagePrice: - NewSubscriptionMaxGroupTieredPackagePrice - ) = apply { - cadence = newSubscriptionMaxGroupTieredPackagePrice.cadence - itemId = newSubscriptionMaxGroupTieredPackagePrice.itemId + internal fun from(maxGroupTieredPackage: MaxGroupTieredPackage) = apply { + cadence = maxGroupTieredPackage.cadence + itemId = maxGroupTieredPackage.itemId maxGroupTieredPackageConfig = - newSubscriptionMaxGroupTieredPackagePrice.maxGroupTieredPackageConfig - modelType = newSubscriptionMaxGroupTieredPackagePrice.modelType - name = newSubscriptionMaxGroupTieredPackagePrice.name - billableMetricId = - newSubscriptionMaxGroupTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionMaxGroupTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionMaxGroupTieredPackagePrice.conversionRate - currency = newSubscriptionMaxGroupTieredPackagePrice.currency - externalPriceId = newSubscriptionMaxGroupTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMaxGroupTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMaxGroupTieredPackagePrice.invoiceGroupingKey + maxGroupTieredPackage.maxGroupTieredPackageConfig + modelType = maxGroupTieredPackage.modelType + name = maxGroupTieredPackage.name + billableMetricId = maxGroupTieredPackage.billableMetricId + billedInAdvance = maxGroupTieredPackage.billedInAdvance + billingCycleConfiguration = maxGroupTieredPackage.billingCycleConfiguration + conversionRate = maxGroupTieredPackage.conversionRate + currency = maxGroupTieredPackage.currency + externalPriceId = maxGroupTieredPackage.externalPriceId + fixedPriceQuantity = maxGroupTieredPackage.fixedPriceQuantity + invoiceGroupingKey = maxGroupTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMaxGroupTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionMaxGroupTieredPackagePrice.metadata - referenceId = newSubscriptionMaxGroupTieredPackagePrice.referenceId + maxGroupTieredPackage.invoicingCycleConfiguration + metadata = maxGroupTieredPackage.metadata + referenceId = maxGroupTieredPackage.referenceId additionalProperties = - newSubscriptionMaxGroupTieredPackagePrice.additionalProperties - .toMutableMap() + maxGroupTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -115259,7 +113801,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMaxGroupTieredPackagePrice]. + * Returns an immutable instance of [MaxGroupTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -115273,8 +113815,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMaxGroupTieredPackagePrice = - NewSubscriptionMaxGroupTieredPackagePrice( + fun build(): MaxGroupTieredPackage = + MaxGroupTieredPackage( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -115300,7 +113842,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMaxGroupTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPackage = apply { if (validated) { return@apply } @@ -116475,7 +115017,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ + return /* spotless:off */ other is MaxGroupTieredPackage && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && 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 */ @@ -116485,10 +115027,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" + "MaxGroupTieredPackage{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, 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}" } - class NewSubscriptionGroupedWithMeteredMinimumPrice + class GroupedWithMeteredMinimum private constructor( private val cadence: JsonField, private val groupedWithMeteredMinimumConfig: @@ -116901,7 +115443,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * [GroupedWithMeteredMinimum]. * * The following fields are required: * ```java @@ -116914,7 +115456,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedWithMeteredMinimumPrice]. */ + /** A builder for [GroupedWithMeteredMinimum]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -116942,41 +115484,30 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedWithMeteredMinimumPrice: - NewSubscriptionGroupedWithMeteredMinimumPrice - ) = apply { - cadence = newSubscriptionGroupedWithMeteredMinimumPrice.cadence - groupedWithMeteredMinimumConfig = - newSubscriptionGroupedWithMeteredMinimumPrice - .groupedWithMeteredMinimumConfig - itemId = newSubscriptionGroupedWithMeteredMinimumPrice.itemId - modelType = newSubscriptionGroupedWithMeteredMinimumPrice.modelType - name = newSubscriptionGroupedWithMeteredMinimumPrice.name - billableMetricId = - newSubscriptionGroupedWithMeteredMinimumPrice.billableMetricId - billedInAdvance = - newSubscriptionGroupedWithMeteredMinimumPrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice.billingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithMeteredMinimumPrice.conversionRate - currency = newSubscriptionGroupedWithMeteredMinimumPrice.currency - externalPriceId = - newSubscriptionGroupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedWithMeteredMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newSubscriptionGroupedWithMeteredMinimumPrice - .invoicingCycleConfiguration - metadata = newSubscriptionGroupedWithMeteredMinimumPrice.metadata - referenceId = newSubscriptionGroupedWithMeteredMinimumPrice.referenceId - additionalProperties = - newSubscriptionGroupedWithMeteredMinimumPrice.additionalProperties - .toMutableMap() - } + internal fun from(groupedWithMeteredMinimum: GroupedWithMeteredMinimum) = + apply { + cadence = groupedWithMeteredMinimum.cadence + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimum.groupedWithMeteredMinimumConfig + itemId = groupedWithMeteredMinimum.itemId + modelType = groupedWithMeteredMinimum.modelType + name = groupedWithMeteredMinimum.name + billableMetricId = groupedWithMeteredMinimum.billableMetricId + billedInAdvance = groupedWithMeteredMinimum.billedInAdvance + billingCycleConfiguration = + groupedWithMeteredMinimum.billingCycleConfiguration + conversionRate = groupedWithMeteredMinimum.conversionRate + currency = groupedWithMeteredMinimum.currency + externalPriceId = groupedWithMeteredMinimum.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimum.fixedPriceQuantity + invoiceGroupingKey = groupedWithMeteredMinimum.invoiceGroupingKey + invoicingCycleConfiguration = + groupedWithMeteredMinimum.invoicingCycleConfiguration + metadata = groupedWithMeteredMinimum.metadata + referenceId = groupedWithMeteredMinimum.referenceId + additionalProperties = + groupedWithMeteredMinimum.additionalProperties.toMutableMap() + } /** The cadence to bill for this price on. */ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) @@ -117356,8 +115887,7 @@ private constructor( } /** - * Returns an immutable instance of - * [NewSubscriptionGroupedWithMeteredMinimumPrice]. + * Returns an immutable instance of [GroupedWithMeteredMinimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -117371,8 +115901,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedWithMeteredMinimumPrice = - NewSubscriptionGroupedWithMeteredMinimumPrice( + fun build(): GroupedWithMeteredMinimum = + GroupedWithMeteredMinimum( checkRequired("cadence", cadence), checkRequired( "groupedWithMeteredMinimumConfig", @@ -117398,7 +115928,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedWithMeteredMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimum = apply { if (validated) { return@apply } @@ -118573,7 +117103,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithMeteredMinimumPrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -118583,10 +117113,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithMeteredMinimumPrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimum{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionMatrixWithDisplayNamePrice + class MatrixWithDisplayName private constructor( private val cadence: JsonField, private val itemId: JsonField, @@ -118996,7 +117526,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionMatrixWithDisplayNamePrice]. + * [MatrixWithDisplayName]. * * The following fields are required: * ```java @@ -119009,7 +117539,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionMatrixWithDisplayNamePrice]. */ + /** A builder for [MatrixWithDisplayName]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -119036,35 +117566,27 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionMatrixWithDisplayNamePrice: - NewSubscriptionMatrixWithDisplayNamePrice - ) = apply { - cadence = newSubscriptionMatrixWithDisplayNamePrice.cadence - itemId = newSubscriptionMatrixWithDisplayNamePrice.itemId + internal fun from(matrixWithDisplayName: MatrixWithDisplayName) = apply { + cadence = matrixWithDisplayName.cadence + itemId = matrixWithDisplayName.itemId matrixWithDisplayNameConfig = - newSubscriptionMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - modelType = newSubscriptionMatrixWithDisplayNamePrice.modelType - name = newSubscriptionMatrixWithDisplayNamePrice.name - billableMetricId = - newSubscriptionMatrixWithDisplayNamePrice.billableMetricId - billedInAdvance = newSubscriptionMatrixWithDisplayNamePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.billingCycleConfiguration - conversionRate = newSubscriptionMatrixWithDisplayNamePrice.conversionRate - currency = newSubscriptionMatrixWithDisplayNamePrice.currency - externalPriceId = newSubscriptionMatrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionMatrixWithDisplayNamePrice.invoiceGroupingKey + matrixWithDisplayName.matrixWithDisplayNameConfig + modelType = matrixWithDisplayName.modelType + name = matrixWithDisplayName.name + billableMetricId = matrixWithDisplayName.billableMetricId + billedInAdvance = matrixWithDisplayName.billedInAdvance + billingCycleConfiguration = matrixWithDisplayName.billingCycleConfiguration + conversionRate = matrixWithDisplayName.conversionRate + currency = matrixWithDisplayName.currency + externalPriceId = matrixWithDisplayName.externalPriceId + fixedPriceQuantity = matrixWithDisplayName.fixedPriceQuantity + invoiceGroupingKey = matrixWithDisplayName.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionMatrixWithDisplayNamePrice.invoicingCycleConfiguration - metadata = newSubscriptionMatrixWithDisplayNamePrice.metadata - referenceId = newSubscriptionMatrixWithDisplayNamePrice.referenceId + matrixWithDisplayName.invoicingCycleConfiguration + metadata = matrixWithDisplayName.metadata + referenceId = matrixWithDisplayName.referenceId additionalProperties = - newSubscriptionMatrixWithDisplayNamePrice.additionalProperties - .toMutableMap() + matrixWithDisplayName.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -119440,7 +117962,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionMatrixWithDisplayNamePrice]. + * Returns an immutable instance of [MatrixWithDisplayName]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -119454,8 +117976,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionMatrixWithDisplayNamePrice = - NewSubscriptionMatrixWithDisplayNamePrice( + fun build(): MatrixWithDisplayName = + MatrixWithDisplayName( checkRequired("cadence", cadence), checkRequired("itemId", itemId), checkRequired( @@ -119481,7 +118003,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionMatrixWithDisplayNamePrice = apply { + fun validate(): MatrixWithDisplayName = apply { if (validated) { return@apply } @@ -120656,7 +119178,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixWithDisplayNamePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayName && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -120666,10 +119188,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixWithDisplayNamePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "MatrixWithDisplayName{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } - class NewSubscriptionGroupedTieredPackagePrice + class GroupedTieredPackage private constructor( private val cadence: JsonField, private val groupedTieredPackageConfig: JsonField, @@ -121079,7 +119601,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [NewSubscriptionGroupedTieredPackagePrice]. + * [GroupedTieredPackage]. * * The following fields are required: * ```java @@ -121092,7 +119614,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [NewSubscriptionGroupedTieredPackagePrice]. */ + /** A builder for [GroupedTieredPackage]. */ class Builder internal constructor() { private var cadence: JsonField? = null @@ -121118,34 +119640,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - newSubscriptionGroupedTieredPackagePrice: - NewSubscriptionGroupedTieredPackagePrice - ) = apply { - cadence = newSubscriptionGroupedTieredPackagePrice.cadence - groupedTieredPackageConfig = - newSubscriptionGroupedTieredPackagePrice.groupedTieredPackageConfig - itemId = newSubscriptionGroupedTieredPackagePrice.itemId - modelType = newSubscriptionGroupedTieredPackagePrice.modelType - name = newSubscriptionGroupedTieredPackagePrice.name - billableMetricId = newSubscriptionGroupedTieredPackagePrice.billableMetricId - billedInAdvance = newSubscriptionGroupedTieredPackagePrice.billedInAdvance - billingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.billingCycleConfiguration - conversionRate = newSubscriptionGroupedTieredPackagePrice.conversionRate - currency = newSubscriptionGroupedTieredPackagePrice.currency - externalPriceId = newSubscriptionGroupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = - newSubscriptionGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = - newSubscriptionGroupedTieredPackagePrice.invoiceGroupingKey + internal fun from(groupedTieredPackage: GroupedTieredPackage) = apply { + cadence = groupedTieredPackage.cadence + groupedTieredPackageConfig = groupedTieredPackage.groupedTieredPackageConfig + itemId = groupedTieredPackage.itemId + modelType = groupedTieredPackage.modelType + name = groupedTieredPackage.name + billableMetricId = groupedTieredPackage.billableMetricId + billedInAdvance = groupedTieredPackage.billedInAdvance + billingCycleConfiguration = groupedTieredPackage.billingCycleConfiguration + conversionRate = groupedTieredPackage.conversionRate + currency = groupedTieredPackage.currency + externalPriceId = groupedTieredPackage.externalPriceId + fixedPriceQuantity = groupedTieredPackage.fixedPriceQuantity + invoiceGroupingKey = groupedTieredPackage.invoiceGroupingKey invoicingCycleConfiguration = - newSubscriptionGroupedTieredPackagePrice.invoicingCycleConfiguration - metadata = newSubscriptionGroupedTieredPackagePrice.metadata - referenceId = newSubscriptionGroupedTieredPackagePrice.referenceId + groupedTieredPackage.invoicingCycleConfiguration + metadata = groupedTieredPackage.metadata + referenceId = groupedTieredPackage.referenceId additionalProperties = - newSubscriptionGroupedTieredPackagePrice.additionalProperties - .toMutableMap() + groupedTieredPackage.additionalProperties.toMutableMap() } /** The cadence to bill for this price on. */ @@ -121521,7 +120035,7 @@ private constructor( } /** - * Returns an immutable instance of [NewSubscriptionGroupedTieredPackagePrice]. + * Returns an immutable instance of [GroupedTieredPackage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -121535,8 +120049,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): NewSubscriptionGroupedTieredPackagePrice = - NewSubscriptionGroupedTieredPackagePrice( + fun build(): GroupedTieredPackage = + GroupedTieredPackage( checkRequired("cadence", cadence), checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("itemId", itemId), @@ -121559,7 +120073,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NewSubscriptionGroupedTieredPackagePrice = apply { + fun validate(): GroupedTieredPackage = apply { if (validated) { return@apply } @@ -122733,7 +121247,7 @@ private constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedTieredPackagePrice && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackage && 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 && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -122743,7 +121257,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedTieredPackagePrice{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "GroupedTieredPackage{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, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } 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 1e50552d4..3a1a1d99b 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 @@ -1068,17 +1068,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1722,41 +1722,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1905,66 +1892,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1977,34 +1954,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2029,25 +1998,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2058,21 +2021,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2080,27 +2041,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2109,21 +2063,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2149,44 +2097,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2202,23 +2135,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2399,8 +2328,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2415,7 +2343,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2428,21 +2356,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2603,7 +2526,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2619,8 +2542,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2636,7 +2559,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2688,7 +2611,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2698,10 +2621,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2882,8 +2805,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2898,7 +2820,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2911,21 +2833,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3086,7 +3003,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3102,8 +3019,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3119,7 +3036,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3171,7 +3088,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3181,10 +3098,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3367,7 +3284,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3382,7 +3299,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3395,23 +3312,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3572,7 +3483,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3588,8 +3499,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3605,7 +3516,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3657,7 +3568,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3667,10 +3578,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3873,8 +3784,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3890,7 +3800,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3904,22 +3814,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4091,7 +3996,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4108,8 +4013,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4126,7 +4031,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4178,7 +4083,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4188,10 +4093,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4372,8 +4277,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4388,7 +4292,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4401,21 +4305,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4575,7 +4474,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4591,8 +4490,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4608,7 +4507,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4658,7 +4557,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4668,7 +4567,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4961,17 +4860,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4979,11 +4878,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5004,15 +4903,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5038,12 +4937,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5070,14 +4968,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5086,11 +4982,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5116,17 +5012,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5153,7 +5049,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5317,8 +5213,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5332,7 +5227,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5344,17 +5239,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5497,7 +5390,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5512,8 +5405,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5530,7 +5423,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5576,7 +5469,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5586,10 +5479,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5753,8 +5646,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5768,7 +5660,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5780,19 +5672,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5937,7 +5825,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5952,8 +5840,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5970,7 +5858,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6016,7 +5904,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6026,10 +5914,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6194,8 +6082,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6209,7 +6096,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6221,16 +6108,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6376,7 +6262,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6391,8 +6277,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6409,7 +6295,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6455,7 +6341,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6465,7 +6351,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8265,142 +8151,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 d37bc012b..f3aa4d8bc 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 @@ -1065,17 +1065,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1719,41 +1719,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1902,66 +1889,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1974,34 +1951,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2026,25 +1995,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2055,21 +2018,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2077,27 +2038,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2106,21 +2060,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2146,44 +2094,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2199,23 +2132,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2396,8 +2325,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2412,7 +2340,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2425,21 +2353,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2600,7 +2523,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2616,8 +2539,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2633,7 +2556,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2685,7 +2608,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2695,10 +2618,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2879,8 +2802,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2895,7 +2817,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2908,21 +2830,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3083,7 +3000,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3099,8 +3016,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3116,7 +3033,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3168,7 +3085,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3178,10 +3095,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3364,7 +3281,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3379,7 +3296,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3392,23 +3309,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3569,7 +3480,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3585,8 +3496,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3602,7 +3513,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3654,7 +3565,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3664,10 +3575,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3870,8 +3781,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3887,7 +3797,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3901,22 +3811,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4088,7 +3993,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4105,8 +4010,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4123,7 +4028,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4175,7 +4080,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4185,10 +4090,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4369,8 +4274,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4385,7 +4289,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4398,21 +4302,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4572,7 +4471,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4588,8 +4487,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4605,7 +4504,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4655,7 +4554,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4665,7 +4564,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4958,17 +4857,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4976,11 +4875,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5001,15 +4900,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5035,12 +4934,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5067,14 +4965,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5083,11 +4979,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5113,17 +5009,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5150,7 +5046,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5314,8 +5210,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5329,7 +5224,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5341,17 +5236,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5494,7 +5387,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5509,8 +5402,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5527,7 +5420,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5573,7 +5466,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5583,10 +5476,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5750,8 +5643,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5765,7 +5657,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5777,19 +5669,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5934,7 +5822,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5949,8 +5837,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5967,7 +5855,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6013,7 +5901,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6023,10 +5911,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6191,8 +6079,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6206,7 +6093,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6218,16 +6105,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6373,7 +6259,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6388,8 +6274,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6406,7 +6292,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6452,7 +6338,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6462,7 +6348,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8262,142 +8148,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 17ac0823a..7f49483fe 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 @@ -1074,17 +1074,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1728,41 +1728,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1911,66 +1898,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1983,34 +1960,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2035,25 +2004,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2064,21 +2027,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2086,27 +2047,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2115,21 +2069,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2155,44 +2103,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2208,23 +2141,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2405,8 +2334,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2421,7 +2349,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2434,21 +2362,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2609,7 +2532,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2625,8 +2548,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2642,7 +2565,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2694,7 +2617,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2704,10 +2627,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2888,8 +2811,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2904,7 +2826,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2917,21 +2839,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3092,7 +3009,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3108,8 +3025,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3125,7 +3042,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3177,7 +3094,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3187,10 +3104,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3373,7 +3290,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3388,7 +3305,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3401,23 +3318,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3578,7 +3489,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3594,8 +3505,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3611,7 +3522,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3663,7 +3574,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3673,10 +3584,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3879,8 +3790,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3896,7 +3806,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3910,22 +3820,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4097,7 +4002,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4114,8 +4019,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4132,7 +4037,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4184,7 +4089,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4194,10 +4099,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4378,8 +4283,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4394,7 +4298,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4407,21 +4311,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4581,7 +4480,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4597,8 +4496,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4614,7 +4513,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4664,7 +4563,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4674,7 +4573,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4967,17 +4866,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4985,11 +4884,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5010,15 +4909,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5044,12 +4943,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5076,14 +4974,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5092,11 +4988,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5122,17 +5018,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5159,7 +5055,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5323,8 +5219,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5338,7 +5233,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5350,17 +5245,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5503,7 +5396,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5518,8 +5411,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5536,7 +5429,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5582,7 +5475,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5592,10 +5485,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5759,8 +5652,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5774,7 +5666,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5786,19 +5678,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5943,7 +5831,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5958,8 +5846,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5976,7 +5864,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6022,7 +5910,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6032,10 +5920,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6200,8 +6088,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6215,7 +6102,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6227,16 +6114,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6382,7 +6268,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6397,8 +6283,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6415,7 +6301,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6461,7 +6347,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6471,7 +6357,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8271,142 +8157,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 58a27d0e3..02cefb2ed 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 @@ -1083,17 +1083,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1737,41 +1737,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1920,66 +1907,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1992,34 +1969,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2044,25 +2013,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2073,21 +2036,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2095,27 +2056,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2124,21 +2078,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2164,44 +2112,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2217,23 +2150,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2414,8 +2343,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2430,7 +2358,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2443,21 +2371,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2618,7 +2541,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2634,8 +2557,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2651,7 +2574,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2703,7 +2626,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2713,10 +2636,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2897,8 +2820,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2913,7 +2835,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2926,21 +2848,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3101,7 +3018,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3117,8 +3034,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3134,7 +3051,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3186,7 +3103,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3196,10 +3113,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3382,7 +3299,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3397,7 +3314,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3410,23 +3327,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3587,7 +3498,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3603,8 +3514,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3620,7 +3531,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3672,7 +3583,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3682,10 +3593,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3888,8 +3799,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3905,7 +3815,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3919,22 +3829,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4106,7 +4011,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4123,8 +4028,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4141,7 +4046,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4193,7 +4098,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4203,10 +4108,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4387,8 +4292,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4403,7 +4307,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4416,21 +4320,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4590,7 +4489,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4606,8 +4505,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4623,7 +4522,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4673,7 +4572,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4683,7 +4582,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4976,17 +4875,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4994,11 +4893,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5019,15 +4918,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5053,12 +4952,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5085,14 +4983,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5101,11 +4997,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5131,17 +5027,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5168,7 +5064,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5332,8 +5228,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5347,7 +5242,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5359,17 +5254,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5512,7 +5405,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5527,8 +5420,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5545,7 +5438,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5591,7 +5484,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5601,10 +5494,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5768,8 +5661,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5783,7 +5675,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5795,19 +5687,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5952,7 +5840,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5967,8 +5855,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5985,7 +5873,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6031,7 +5919,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6041,10 +5929,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6209,8 +6097,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6224,7 +6111,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6236,16 +6123,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6391,7 +6277,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6406,8 +6292,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6424,7 +6310,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6470,7 +6356,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6480,7 +6366,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8280,142 +8166,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 30c018291..2605a4d88 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 @@ -1078,17 +1078,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1732,41 +1732,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1915,66 +1902,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1987,34 +1964,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2039,25 +2008,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2068,21 +2031,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2090,27 +2051,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2119,21 +2073,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2159,44 +2107,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2212,23 +2145,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2409,8 +2338,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2425,7 +2353,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2438,21 +2366,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2613,7 +2536,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2629,8 +2552,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2646,7 +2569,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2698,7 +2621,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2708,10 +2631,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2892,8 +2815,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2908,7 +2830,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2921,21 +2843,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3096,7 +3013,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3112,8 +3029,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3129,7 +3046,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3181,7 +3098,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3191,10 +3108,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3377,7 +3294,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3392,7 +3309,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3405,23 +3322,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3582,7 +3493,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3598,8 +3509,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3615,7 +3526,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3667,7 +3578,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3677,10 +3588,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3883,8 +3794,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3900,7 +3810,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3914,22 +3824,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4101,7 +4006,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4118,8 +4023,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4136,7 +4041,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4188,7 +4093,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4198,10 +4103,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4382,8 +4287,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4398,7 +4302,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4411,21 +4315,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4585,7 +4484,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4601,8 +4500,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4618,7 +4517,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4668,7 +4567,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4678,7 +4577,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4971,17 +4870,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4989,11 +4888,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5014,15 +4913,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5048,12 +4947,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5080,14 +4978,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5096,11 +4992,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5126,17 +5022,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5163,7 +5059,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5327,8 +5223,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5342,7 +5237,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5354,17 +5249,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5507,7 +5400,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5522,8 +5415,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5540,7 +5433,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5586,7 +5479,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5596,10 +5489,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5763,8 +5656,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5778,7 +5670,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5790,19 +5682,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5947,7 +5835,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5962,8 +5850,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5980,7 +5868,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6026,7 +5914,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6036,10 +5924,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6204,8 +6092,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6219,7 +6106,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6231,16 +6118,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6386,7 +6272,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6401,8 +6287,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6419,7 +6305,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6465,7 +6351,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6475,7 +6361,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8275,142 +8161,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 9c3924ef9..878b1068c 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 @@ -1074,17 +1074,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1728,41 +1728,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1911,66 +1898,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1983,34 +1960,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2035,25 +2004,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2064,21 +2027,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2086,27 +2047,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2115,21 +2069,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2155,44 +2103,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2208,23 +2141,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2405,8 +2334,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2421,7 +2349,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2434,21 +2362,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2609,7 +2532,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2625,8 +2548,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2642,7 +2565,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2694,7 +2617,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2704,10 +2627,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2888,8 +2811,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2904,7 +2826,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2917,21 +2839,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3092,7 +3009,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3108,8 +3025,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3125,7 +3042,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3177,7 +3094,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3187,10 +3104,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3373,7 +3290,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3388,7 +3305,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3401,23 +3318,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3578,7 +3489,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3594,8 +3505,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3611,7 +3522,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3663,7 +3574,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3673,10 +3584,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3879,8 +3790,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3896,7 +3806,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3910,22 +3820,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4097,7 +4002,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4114,8 +4019,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4132,7 +4037,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4184,7 +4089,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4194,10 +4099,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4378,8 +4283,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4394,7 +4298,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4407,21 +4311,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4581,7 +4480,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4597,8 +4496,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4614,7 +4513,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4664,7 +4563,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4674,7 +4573,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4967,17 +4866,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4985,11 +4884,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5010,15 +4909,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5044,12 +4943,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5076,14 +4974,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5092,11 +4988,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5122,17 +5018,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5159,7 +5055,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5323,8 +5219,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5338,7 +5233,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5350,17 +5245,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5503,7 +5396,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5518,8 +5411,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5536,7 +5429,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5582,7 +5475,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5592,10 +5485,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5759,8 +5652,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5774,7 +5666,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5786,19 +5678,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5943,7 +5831,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5958,8 +5846,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5976,7 +5864,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6022,7 +5910,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6032,10 +5920,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6200,8 +6088,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6215,7 +6102,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6227,16 +6114,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6382,7 +6268,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6397,8 +6283,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6415,7 +6301,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6461,7 +6347,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6471,7 +6357,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8271,142 +8157,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** 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 c7cb7bf06..5925a7654 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 @@ -1065,17 +1065,17 @@ private constructor( } /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofAmount(amount)`. */ - fun addDiscountInterval(amount: DiscountInterval.AmountDiscountInterval) = + fun addDiscountInterval(amount: DiscountInterval.Amount) = addDiscountInterval(DiscountInterval.ofAmount(amount)) /** * Alias for calling [addDiscountInterval] with `DiscountInterval.ofPercentage(percentage)`. */ - fun addDiscountInterval(percentage: DiscountInterval.PercentageDiscountInterval) = + fun addDiscountInterval(percentage: DiscountInterval.Percentage) = addDiscountInterval(DiscountInterval.ofPercentage(percentage)) /** Alias for calling [addDiscountInterval] with `DiscountInterval.ofUsage(usage)`. */ - fun addDiscountInterval(usage: DiscountInterval.UsageDiscountInterval) = + fun addDiscountInterval(usage: DiscountInterval.Usage) = addDiscountInterval(DiscountInterval.ofUsage(usage)) /** The date Orb stops billing for this subscription. */ @@ -1719,41 +1719,28 @@ private constructor( this.adjustment = adjustment } - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)`. - */ - fun adjustment(planPhaseUsageDiscount: Adjustment.PlanPhaseUsageDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseUsageDiscount(planPhaseUsageDiscount)) + /** Alias for calling [adjustment] with `Adjustment.ofUsageDiscount(usageDiscount)`. */ + fun adjustment(usageDiscount: Adjustment.UsageDiscount) = + adjustment(Adjustment.ofUsageDiscount(usageDiscount)) /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)`. + * Alias for calling [adjustment] with `Adjustment.ofAmountDiscount(amountDiscount)`. */ - fun adjustment(planPhaseAmountDiscount: Adjustment.PlanPhaseAmountDiscountAdjustment) = - adjustment(Adjustment.ofPlanPhaseAmountDiscount(planPhaseAmountDiscount)) + fun adjustment(amountDiscount: Adjustment.AmountDiscount) = + adjustment(Adjustment.ofAmountDiscount(amountDiscount)) /** * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)`. + * `Adjustment.ofPercentageDiscount(percentageDiscount)`. */ - fun adjustment( - planPhasePercentageDiscount: Adjustment.PlanPhasePercentageDiscountAdjustment - ) = adjustment(Adjustment.ofPlanPhasePercentageDiscount(planPhasePercentageDiscount)) + fun adjustment(percentageDiscount: Adjustment.PercentageDiscount) = + adjustment(Adjustment.ofPercentageDiscount(percentageDiscount)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)`. - */ - fun adjustment(planPhaseMinimum: Adjustment.PlanPhaseMinimumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMinimum(planPhaseMinimum)) + /** Alias for calling [adjustment] with `Adjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: Adjustment.Minimum) = adjustment(Adjustment.ofMinimum(minimum)) - /** - * Alias for calling [adjustment] with - * `Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)`. - */ - fun adjustment(planPhaseMaximum: Adjustment.PlanPhaseMaximumAdjustment) = - adjustment(Adjustment.ofPlanPhaseMaximum(planPhaseMaximum)) + /** Alias for calling [adjustment] with `Adjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: Adjustment.Maximum) = adjustment(Adjustment.ofMaximum(maximum)) /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = @@ -1902,66 +1889,56 @@ private constructor( @JsonSerialize(using = Adjustment.Serializer::class) class Adjustment private constructor( - private val planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment? = null, - private val planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment? = null, - private val planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment? = null, - private val planPhaseMinimum: PlanPhaseMinimumAdjustment? = null, - private val planPhaseMaximum: PlanPhaseMaximumAdjustment? = null, + private val usageDiscount: UsageDiscount? = null, + private val amountDiscount: AmountDiscount? = null, + private val percentageDiscount: PercentageDiscount? = null, + private val minimum: Minimum? = null, + private val maximum: Maximum? = null, private val _json: JsonValue? = null, ) { - fun planPhaseUsageDiscount(): Optional = - Optional.ofNullable(planPhaseUsageDiscount) + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - fun planPhaseAmountDiscount(): Optional = - Optional.ofNullable(planPhaseAmountDiscount) + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - fun planPhasePercentageDiscount(): Optional = - Optional.ofNullable(planPhasePercentageDiscount) + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) - fun planPhaseMinimum(): Optional = - Optional.ofNullable(planPhaseMinimum) + fun minimum(): Optional = Optional.ofNullable(minimum) - fun planPhaseMaximum(): Optional = - Optional.ofNullable(planPhaseMaximum) + fun maximum(): Optional = Optional.ofNullable(maximum) - fun isPlanPhaseUsageDiscount(): Boolean = planPhaseUsageDiscount != null + fun isUsageDiscount(): Boolean = usageDiscount != null - fun isPlanPhaseAmountDiscount(): Boolean = planPhaseAmountDiscount != null + fun isAmountDiscount(): Boolean = amountDiscount != null - fun isPlanPhasePercentageDiscount(): Boolean = planPhasePercentageDiscount != null + fun isPercentageDiscount(): Boolean = percentageDiscount != null - fun isPlanPhaseMinimum(): Boolean = planPhaseMinimum != null + fun isMinimum(): Boolean = minimum != null - fun isPlanPhaseMaximum(): Boolean = planPhaseMaximum != null + fun isMaximum(): Boolean = maximum != null - fun asPlanPhaseUsageDiscount(): PlanPhaseUsageDiscountAdjustment = - planPhaseUsageDiscount.getOrThrow("planPhaseUsageDiscount") + fun asUsageDiscount(): UsageDiscount = usageDiscount.getOrThrow("usageDiscount") - fun asPlanPhaseAmountDiscount(): PlanPhaseAmountDiscountAdjustment = - planPhaseAmountDiscount.getOrThrow("planPhaseAmountDiscount") + fun asAmountDiscount(): AmountDiscount = amountDiscount.getOrThrow("amountDiscount") - fun asPlanPhasePercentageDiscount(): PlanPhasePercentageDiscountAdjustment = - planPhasePercentageDiscount.getOrThrow("planPhasePercentageDiscount") + fun asPercentageDiscount(): PercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") - fun asPlanPhaseMinimum(): PlanPhaseMinimumAdjustment = - planPhaseMinimum.getOrThrow("planPhaseMinimum") + fun asMinimum(): Minimum = minimum.getOrThrow("minimum") - fun asPlanPhaseMaximum(): PlanPhaseMaximumAdjustment = - planPhaseMaximum.getOrThrow("planPhaseMaximum") + fun asMaximum(): Maximum = maximum.getOrThrow("maximum") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - planPhaseUsageDiscount != null -> - visitor.visitPlanPhaseUsageDiscount(planPhaseUsageDiscount) - planPhaseAmountDiscount != null -> - visitor.visitPlanPhaseAmountDiscount(planPhaseAmountDiscount) - planPhasePercentageDiscount != null -> - visitor.visitPlanPhasePercentageDiscount(planPhasePercentageDiscount) - planPhaseMinimum != null -> visitor.visitPlanPhaseMinimum(planPhaseMinimum) - planPhaseMaximum != null -> visitor.visitPlanPhaseMaximum(planPhaseMaximum) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) else -> visitor.unknown(_json) } @@ -1974,34 +1951,26 @@ private constructor( accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) { - planPhaseUsageDiscount.validate() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) { + usageDiscount.validate() } - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) { - planPhaseAmountDiscount.validate() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) { + amountDiscount.validate() } - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount ) { - planPhasePercentageDiscount.validate() + percentageDiscount.validate() } - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) { - planPhaseMinimum.validate() + override fun visitMinimum(minimum: Minimum) { + minimum.validate() } - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) { - planPhaseMaximum.validate() + override fun visitMaximum(maximum: Maximum) { + maximum.validate() } } ) @@ -2026,25 +1995,19 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = planPhaseUsageDiscount.validity() + override fun visitUsageDiscount(usageDiscount: UsageDiscount) = + usageDiscount.validity() - override fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = planPhaseAmountDiscount.validity() + override fun visitAmountDiscount(amountDiscount: AmountDiscount) = + amountDiscount.validity() - override fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = planPhasePercentageDiscount.validity() + override fun visitPercentageDiscount( + percentageDiscount: PercentageDiscount + ) = percentageDiscount.validity() - override fun visitPlanPhaseMinimum( - planPhaseMinimum: PlanPhaseMinimumAdjustment - ) = planPhaseMinimum.validity() + override fun visitMinimum(minimum: Minimum) = minimum.validity() - override fun visitPlanPhaseMaximum( - planPhaseMaximum: PlanPhaseMaximumAdjustment - ) = planPhaseMaximum.validity() + override fun visitMaximum(maximum: Maximum) = maximum.validity() override fun unknown(json: JsonValue?) = 0 } @@ -2055,21 +2018,19 @@ private constructor( return true } - return /* spotless:off */ other is Adjustment && planPhaseUsageDiscount == other.planPhaseUsageDiscount && planPhaseAmountDiscount == other.planPhaseAmountDiscount && planPhasePercentageDiscount == other.planPhasePercentageDiscount && planPhaseMinimum == other.planPhaseMinimum && planPhaseMaximum == other.planPhaseMaximum /* spotless:on */ + return /* spotless:off */ other is Adjustment && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planPhaseUsageDiscount, planPhaseAmountDiscount, planPhasePercentageDiscount, planPhaseMinimum, planPhaseMaximum) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(usageDiscount, amountDiscount, percentageDiscount, minimum, maximum) /* spotless:on */ override fun toString(): String = when { - planPhaseUsageDiscount != null -> - "Adjustment{planPhaseUsageDiscount=$planPhaseUsageDiscount}" - planPhaseAmountDiscount != null -> - "Adjustment{planPhaseAmountDiscount=$planPhaseAmountDiscount}" - planPhasePercentageDiscount != null -> - "Adjustment{planPhasePercentageDiscount=$planPhasePercentageDiscount}" - planPhaseMinimum != null -> "Adjustment{planPhaseMinimum=$planPhaseMinimum}" - planPhaseMaximum != null -> "Adjustment{planPhaseMaximum=$planPhaseMaximum}" + usageDiscount != null -> "Adjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "Adjustment{amountDiscount=$amountDiscount}" + percentageDiscount != null -> + "Adjustment{percentageDiscount=$percentageDiscount}" + minimum != null -> "Adjustment{minimum=$minimum}" + maximum != null -> "Adjustment{maximum=$maximum}" _json != null -> "Adjustment{_unknown=$_json}" else -> throw IllegalStateException("Invalid Adjustment") } @@ -2077,27 +2038,20 @@ private constructor( companion object { @JvmStatic - fun ofPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ) = Adjustment(planPhaseUsageDiscount = planPhaseUsageDiscount) + fun ofUsageDiscount(usageDiscount: UsageDiscount) = + Adjustment(usageDiscount = usageDiscount) @JvmStatic - fun ofPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ) = Adjustment(planPhaseAmountDiscount = planPhaseAmountDiscount) + fun ofAmountDiscount(amountDiscount: AmountDiscount) = + Adjustment(amountDiscount = amountDiscount) @JvmStatic - fun ofPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ) = Adjustment(planPhasePercentageDiscount = planPhasePercentageDiscount) + fun ofPercentageDiscount(percentageDiscount: PercentageDiscount) = + Adjustment(percentageDiscount = percentageDiscount) - @JvmStatic - fun ofPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment) = - Adjustment(planPhaseMinimum = planPhaseMinimum) + @JvmStatic fun ofMinimum(minimum: Minimum) = Adjustment(minimum = minimum) - @JvmStatic - fun ofPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment) = - Adjustment(planPhaseMaximum = planPhaseMaximum) + @JvmStatic fun ofMaximum(maximum: Maximum) = Adjustment(maximum = maximum) } /** @@ -2106,21 +2060,15 @@ private constructor( */ interface Visitor { - fun visitPlanPhaseUsageDiscount( - planPhaseUsageDiscount: PlanPhaseUsageDiscountAdjustment - ): T + fun visitUsageDiscount(usageDiscount: UsageDiscount): T - fun visitPlanPhaseAmountDiscount( - planPhaseAmountDiscount: PlanPhaseAmountDiscountAdjustment - ): T + fun visitAmountDiscount(amountDiscount: AmountDiscount): T - fun visitPlanPhasePercentageDiscount( - planPhasePercentageDiscount: PlanPhasePercentageDiscountAdjustment - ): T + fun visitPercentageDiscount(percentageDiscount: PercentageDiscount): T - fun visitPlanPhaseMinimum(planPhaseMinimum: PlanPhaseMinimumAdjustment): T + fun visitMinimum(minimum: Minimum): T - fun visitPlanPhaseMaximum(planPhaseMaximum: PlanPhaseMaximumAdjustment): T + fun visitMaximum(maximum: Maximum): T /** * Maps an unknown variant of [Adjustment] to a value of type [T]. @@ -2146,44 +2094,29 @@ private constructor( when (adjustmentType) { "usage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseUsageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(usageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "amount_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseAmountDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(amountDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "percentage_discount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhasePercentageDiscount = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(percentageDiscount = it, _json = json) + } ?: Adjustment(_json = json) } "minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMinimum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(minimum = it, _json = json) + } ?: Adjustment(_json = json) } "maximum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Adjustment(planPhaseMaximum = it, _json = json) } - ?: Adjustment(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + Adjustment(maximum = it, _json = json) + } ?: Adjustment(_json = json) } } @@ -2199,23 +2132,19 @@ private constructor( provider: SerializerProvider, ) { when { - value.planPhaseUsageDiscount != null -> - generator.writeObject(value.planPhaseUsageDiscount) - value.planPhaseAmountDiscount != null -> - generator.writeObject(value.planPhaseAmountDiscount) - value.planPhasePercentageDiscount != null -> - generator.writeObject(value.planPhasePercentageDiscount) - value.planPhaseMinimum != null -> - generator.writeObject(value.planPhaseMinimum) - value.planPhaseMaximum != null -> - generator.writeObject(value.planPhaseMaximum) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Adjustment") } } } - class PlanPhaseUsageDiscountAdjustment + class UsageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2396,8 +2325,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseUsageDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [UsageDiscount]. * * The following fields are required: * ```java @@ -2412,7 +2340,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseUsageDiscountAdjustment]. */ + /** A builder for [UsageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2425,21 +2353,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseUsageDiscountAdjustment: PlanPhaseUsageDiscountAdjustment - ) = apply { - id = planPhaseUsageDiscountAdjustment.id - adjustmentType = planPhaseUsageDiscountAdjustment.adjustmentType + internal fun from(usageDiscount: UsageDiscount) = apply { + id = usageDiscount.id + adjustmentType = usageDiscount.adjustmentType appliesToPriceIds = - planPhaseUsageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder - reason = planPhaseUsageDiscountAdjustment.reason - usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount - additionalProperties = - planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() + usageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = usageDiscount.isInvoiceLevel + planPhaseOrder = usageDiscount.planPhaseOrder + reason = usageDiscount.reason + this.usageDiscount = usageDiscount.usageDiscount + additionalProperties = usageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -2600,7 +2523,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseUsageDiscountAdjustment]. + * Returns an immutable instance of [UsageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2616,8 +2539,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseUsageDiscountAdjustment = - PlanPhaseUsageDiscountAdjustment( + fun build(): UsageDiscount = + UsageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -2633,7 +2556,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseUsageDiscountAdjustment = apply { + fun validate(): UsageDiscount = apply { if (validated) { return@apply } @@ -2685,7 +2608,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && 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 */ + return /* spotless:off */ other is UsageDiscount && 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 */ @@ -2695,10 +2618,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } - class PlanPhaseAmountDiscountAdjustment + class AmountDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -2879,8 +2802,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseAmountDiscountAdjustment]. + * Returns a mutable builder for constructing an instance of [AmountDiscount]. * * The following fields are required: * ```java @@ -2895,7 +2817,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseAmountDiscountAdjustment]. */ + /** A builder for [AmountDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -2908,21 +2830,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhaseAmountDiscountAdjustment: PlanPhaseAmountDiscountAdjustment - ) = apply { - id = planPhaseAmountDiscountAdjustment.id - adjustmentType = planPhaseAmountDiscountAdjustment.adjustmentType - amountDiscount = planPhaseAmountDiscountAdjustment.amountDiscount + internal fun from(amountDiscount: AmountDiscount) = apply { + id = amountDiscount.id + adjustmentType = amountDiscount.adjustmentType + this.amountDiscount = amountDiscount.amountDiscount appliesToPriceIds = - planPhaseAmountDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel - planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder - reason = planPhaseAmountDiscountAdjustment.reason - additionalProperties = - planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() + amountDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = amountDiscount.isInvoiceLevel + planPhaseOrder = amountDiscount.planPhaseOrder + reason = amountDiscount.reason + additionalProperties = amountDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3083,7 +3000,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseAmountDiscountAdjustment]. + * Returns an immutable instance of [AmountDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3099,8 +3016,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseAmountDiscountAdjustment = - PlanPhaseAmountDiscountAdjustment( + fun build(): AmountDiscount = + AmountDiscount( checkRequired("id", id), adjustmentType, checkRequired("amountDiscount", amountDiscount), @@ -3116,7 +3033,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseAmountDiscountAdjustment = apply { + fun validate(): AmountDiscount = apply { if (validated) { return@apply } @@ -3168,7 +3085,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && 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 */ + return /* spotless:off */ other is AmountDiscount && 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 */ @@ -3178,10 +3095,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "AmountDiscount{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhasePercentageDiscountAdjustment + class PercentageDiscount private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3364,7 +3281,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PlanPhasePercentageDiscountAdjustment]. + * [PercentageDiscount]. * * The following fields are required: * ```java @@ -3379,7 +3296,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhasePercentageDiscountAdjustment]. */ + /** A builder for [PercentageDiscount]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3392,23 +3309,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - planPhasePercentageDiscountAdjustment: PlanPhasePercentageDiscountAdjustment - ) = apply { - id = planPhasePercentageDiscountAdjustment.id - adjustmentType = planPhasePercentageDiscountAdjustment.adjustmentType + internal fun from(percentageDiscount: PercentageDiscount) = apply { + id = percentageDiscount.id + adjustmentType = percentageDiscount.adjustmentType appliesToPriceIds = - planPhasePercentageDiscountAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhasePercentageDiscountAdjustment.isInvoiceLevel - percentageDiscount = - planPhasePercentageDiscountAdjustment.percentageDiscount - planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder - reason = planPhasePercentageDiscountAdjustment.reason + percentageDiscount.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = percentageDiscount.isInvoiceLevel + this.percentageDiscount = percentageDiscount.percentageDiscount + planPhaseOrder = percentageDiscount.planPhaseOrder + reason = percentageDiscount.reason additionalProperties = - planPhasePercentageDiscountAdjustment.additionalProperties - .toMutableMap() + percentageDiscount.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3569,7 +3480,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhasePercentageDiscountAdjustment]. + * Returns an immutable instance of [PercentageDiscount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3585,8 +3496,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhasePercentageDiscountAdjustment = - PlanPhasePercentageDiscountAdjustment( + fun build(): PercentageDiscount = + PercentageDiscount( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -3602,7 +3513,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhasePercentageDiscountAdjustment = apply { + fun validate(): PercentageDiscount = apply { if (validated) { return@apply } @@ -3654,7 +3565,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && 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 */ + return /* spotless:off */ other is PercentageDiscount && 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 */ @@ -3664,10 +3575,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PercentageDiscount{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMinimumAdjustment + class Minimum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -3870,8 +3781,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMinimumAdjustment]. + * Returns a mutable builder for constructing an instance of [Minimum]. * * The following fields are required: * ```java @@ -3887,7 +3797,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMinimumAdjustment]. */ + /** A builder for [Minimum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -3901,22 +3811,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMinimumAdjustment: PlanPhaseMinimumAdjustment) = - apply { - id = planPhaseMinimumAdjustment.id - adjustmentType = planPhaseMinimumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMinimumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMinimumAdjustment.isInvoiceLevel - itemId = planPhaseMinimumAdjustment.itemId - minimumAmount = planPhaseMinimumAdjustment.minimumAmount - planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder - reason = planPhaseMinimumAdjustment.reason - additionalProperties = - planPhaseMinimumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(minimum: Minimum) = apply { + id = minimum.id + adjustmentType = minimum.adjustmentType + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = minimum.isInvoiceLevel + itemId = minimum.itemId + minimumAmount = minimum.minimumAmount + planPhaseOrder = minimum.planPhaseOrder + reason = minimum.reason + additionalProperties = minimum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4088,7 +3993,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMinimumAdjustment]. + * Returns an immutable instance of [Minimum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4105,8 +4010,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMinimumAdjustment = - PlanPhaseMinimumAdjustment( + fun build(): Minimum = + Minimum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4123,7 +4028,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMinimumAdjustment = apply { + fun validate(): Minimum = apply { if (validated) { return@apply } @@ -4175,7 +4080,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && 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 */ + return /* spotless:off */ other is Minimum && 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 */ @@ -4185,10 +4090,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Minimum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } - class PlanPhaseMaximumAdjustment + class Maximum private constructor( private val id: JsonField, private val adjustmentType: JsonValue, @@ -4369,8 +4274,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PlanPhaseMaximumAdjustment]. + * Returns a mutable builder for constructing an instance of [Maximum]. * * The following fields are required: * ```java @@ -4385,7 +4289,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanPhaseMaximumAdjustment]. */ + /** A builder for [Maximum]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -4398,21 +4302,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planPhaseMaximumAdjustment: PlanPhaseMaximumAdjustment) = - apply { - id = planPhaseMaximumAdjustment.id - adjustmentType = planPhaseMaximumAdjustment.adjustmentType - appliesToPriceIds = - planPhaseMaximumAdjustment.appliesToPriceIds.map { - it.toMutableList() - } - isInvoiceLevel = planPhaseMaximumAdjustment.isInvoiceLevel - maximumAmount = planPhaseMaximumAdjustment.maximumAmount - planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder - reason = planPhaseMaximumAdjustment.reason - additionalProperties = - planPhaseMaximumAdjustment.additionalProperties.toMutableMap() - } + internal fun from(maximum: Maximum) = apply { + id = maximum.id + adjustmentType = maximum.adjustmentType + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + isInvoiceLevel = maximum.isInvoiceLevel + maximumAmount = maximum.maximumAmount + planPhaseOrder = maximum.planPhaseOrder + reason = maximum.reason + additionalProperties = maximum.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -4572,7 +4471,7 @@ private constructor( } /** - * Returns an immutable instance of [PlanPhaseMaximumAdjustment]. + * Returns an immutable instance of [Maximum]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4588,8 +4487,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PlanPhaseMaximumAdjustment = - PlanPhaseMaximumAdjustment( + fun build(): Maximum = + Maximum( checkRequired("id", id), adjustmentType, checkRequired("appliesToPriceIds", appliesToPriceIds).map { @@ -4605,7 +4504,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanPhaseMaximumAdjustment = apply { + fun validate(): Maximum = apply { if (validated) { return@apply } @@ -4655,7 +4554,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && 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 */ + return /* spotless:off */ other is Maximum && 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 */ @@ -4665,7 +4564,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "Maximum{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -4958,17 +4857,17 @@ private constructor( @JsonSerialize(using = DiscountInterval.Serializer::class) class DiscountInterval private constructor( - private val amount: AmountDiscountInterval? = null, - private val percentage: PercentageDiscountInterval? = null, - private val usage: UsageDiscountInterval? = null, + private val amount: Amount? = null, + private val percentage: Percentage? = null, + private val usage: Usage? = null, private val _json: JsonValue? = null, ) { - fun amount(): Optional = Optional.ofNullable(amount) + fun amount(): Optional = Optional.ofNullable(amount) - fun percentage(): Optional = Optional.ofNullable(percentage) + fun percentage(): Optional = Optional.ofNullable(percentage) - fun usage(): Optional = Optional.ofNullable(usage) + fun usage(): Optional = Optional.ofNullable(usage) fun isAmount(): Boolean = amount != null @@ -4976,11 +4875,11 @@ private constructor( fun isUsage(): Boolean = usage != null - fun asAmount(): AmountDiscountInterval = amount.getOrThrow("amount") + fun asAmount(): Amount = amount.getOrThrow("amount") - fun asPercentage(): PercentageDiscountInterval = percentage.getOrThrow("percentage") + fun asPercentage(): Percentage = percentage.getOrThrow("percentage") - fun asUsage(): UsageDiscountInterval = usage.getOrThrow("usage") + fun asUsage(): Usage = usage.getOrThrow("usage") fun _json(): Optional = Optional.ofNullable(_json) @@ -5001,15 +4900,15 @@ private constructor( accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) { + override fun visitAmount(amount: Amount) { amount.validate() } - override fun visitPercentage(percentage: PercentageDiscountInterval) { + override fun visitPercentage(percentage: Percentage) { percentage.validate() } - override fun visitUsage(usage: UsageDiscountInterval) { + override fun visitUsage(usage: Usage) { usage.validate() } } @@ -5035,12 +4934,11 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitAmount(amount: AmountDiscountInterval) = amount.validity() + override fun visitAmount(amount: Amount) = amount.validity() - override fun visitPercentage(percentage: PercentageDiscountInterval) = - percentage.validity() + override fun visitPercentage(percentage: Percentage) = percentage.validity() - override fun visitUsage(usage: UsageDiscountInterval) = usage.validity() + override fun visitUsage(usage: Usage) = usage.validity() override fun unknown(json: JsonValue?) = 0 } @@ -5067,14 +4965,12 @@ private constructor( companion object { - @JvmStatic - fun ofAmount(amount: AmountDiscountInterval) = DiscountInterval(amount = amount) + @JvmStatic fun ofAmount(amount: Amount) = DiscountInterval(amount = amount) @JvmStatic - fun ofPercentage(percentage: PercentageDiscountInterval) = - DiscountInterval(percentage = percentage) + fun ofPercentage(percentage: Percentage) = DiscountInterval(percentage = percentage) - @JvmStatic fun ofUsage(usage: UsageDiscountInterval) = DiscountInterval(usage = usage) + @JvmStatic fun ofUsage(usage: Usage) = DiscountInterval(usage = usage) } /** @@ -5083,11 +4979,11 @@ private constructor( */ interface Visitor { - fun visitAmount(amount: AmountDiscountInterval): T + fun visitAmount(amount: Amount): T - fun visitPercentage(percentage: PercentageDiscountInterval): T + fun visitPercentage(percentage: Percentage): T - fun visitUsage(usage: UsageDiscountInterval): T + fun visitUsage(usage: Usage): T /** * Maps an unknown variant of [DiscountInterval] to a value of type [T]. @@ -5113,17 +5009,17 @@ private constructor( when (discountType) { "amount" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(amount = it, _json = json) } ?: DiscountInterval(_json = json) } "percentage" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { DiscountInterval(percentage = it, _json = json) } - ?: DiscountInterval(_json = json) + return tryDeserialize(node, jacksonTypeRef())?.let { + DiscountInterval(percentage = it, _json = json) + } ?: DiscountInterval(_json = json) } "usage" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { + return tryDeserialize(node, jacksonTypeRef())?.let { DiscountInterval(usage = it, _json = json) } ?: DiscountInterval(_json = json) } @@ -5150,7 +5046,7 @@ private constructor( } } - class AmountDiscountInterval + class Amount private constructor( private val amountDiscount: JsonField, private val appliesToPriceIds: JsonField>, @@ -5314,8 +5210,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [AmountDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Amount]. * * The following fields are required: * ```java @@ -5329,7 +5224,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AmountDiscountInterval]. */ + /** A builder for [Amount]. */ class Builder internal constructor() { private var amountDiscount: JsonField? = null @@ -5341,17 +5236,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - amountDiscount = amountDiscountInterval.amountDiscount - appliesToPriceIds = - amountDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(amount: Amount) = apply { + amountDiscount = amount.amountDiscount + appliesToPriceIds = amount.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - amountDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = amountDiscountInterval.discountType - endDate = amountDiscountInterval.endDate - startDate = amountDiscountInterval.startDate - additionalProperties = - amountDiscountInterval.additionalProperties.toMutableMap() + amount.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = amount.discountType + endDate = amount.endDate + startDate = amount.startDate + additionalProperties = amount.additionalProperties.toMutableMap() } /** Only available if discount_type is `amount`. */ @@ -5494,7 +5387,7 @@ private constructor( } /** - * Returns an immutable instance of [AmountDiscountInterval]. + * Returns an immutable instance of [Amount]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5509,8 +5402,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AmountDiscountInterval = - AmountDiscountInterval( + fun build(): Amount = + Amount( checkRequired("amountDiscount", amountDiscount), checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() @@ -5527,7 +5420,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AmountDiscountInterval = apply { + fun validate(): Amount = apply { if (validated) { return@apply } @@ -5573,7 +5466,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Amount && 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 */ @@ -5583,10 +5476,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" + "Amount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class PercentageDiscountInterval + class Percentage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -5750,8 +5643,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [PercentageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Percentage]. * * The following fields are required: * ```java @@ -5765,7 +5657,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PercentageDiscountInterval]. */ + /** A builder for [Percentage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -5777,19 +5669,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { - appliesToPriceIds = - percentageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(percentage: Percentage) = apply { + appliesToPriceIds = percentage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - percentageDiscountInterval.appliesToPriceIntervalIds.map { - it.toMutableList() - } - discountType = percentageDiscountInterval.discountType - endDate = percentageDiscountInterval.endDate - percentageDiscount = percentageDiscountInterval.percentageDiscount - startDate = percentageDiscountInterval.startDate - additionalProperties = - percentageDiscountInterval.additionalProperties.toMutableMap() + percentage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = percentage.discountType + endDate = percentage.endDate + percentageDiscount = percentage.percentageDiscount + startDate = percentage.startDate + additionalProperties = percentage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -5934,7 +5822,7 @@ private constructor( } /** - * Returns an immutable instance of [PercentageDiscountInterval]. + * Returns an immutable instance of [Percentage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5949,8 +5837,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PercentageDiscountInterval = - PercentageDiscountInterval( + fun build(): Percentage = + Percentage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -5967,7 +5855,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PercentageDiscountInterval = apply { + fun validate(): Percentage = apply { if (validated) { return@apply } @@ -6013,7 +5901,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Percentage && 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 */ @@ -6023,10 +5911,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" + "Percentage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } - class UsageDiscountInterval + class Usage private constructor( private val appliesToPriceIds: JsonField>, private val appliesToPriceIntervalIds: JsonField>, @@ -6191,8 +6079,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [UsageDiscountInterval]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java @@ -6206,7 +6093,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UsageDiscountInterval]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { private var appliesToPriceIds: JsonField>? = null @@ -6218,16 +6105,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - appliesToPriceIds = - usageDiscountInterval.appliesToPriceIds.map { it.toMutableList() } + internal fun from(usage: Usage) = apply { + appliesToPriceIds = usage.appliesToPriceIds.map { it.toMutableList() } appliesToPriceIntervalIds = - usageDiscountInterval.appliesToPriceIntervalIds.map { it.toMutableList() } - discountType = usageDiscountInterval.discountType - endDate = usageDiscountInterval.endDate - startDate = usageDiscountInterval.startDate - usageDiscount = usageDiscountInterval.usageDiscount - additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() + usage.appliesToPriceIntervalIds.map { it.toMutableList() } + discountType = usage.discountType + endDate = usage.endDate + startDate = usage.startDate + usageDiscount = usage.usageDiscount + additionalProperties = usage.additionalProperties.toMutableMap() } /** The price ids that this discount interval applies to. */ @@ -6373,7 +6259,7 @@ private constructor( } /** - * Returns an immutable instance of [UsageDiscountInterval]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -6388,8 +6274,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): UsageDiscountInterval = - UsageDiscountInterval( + fun build(): Usage = + Usage( checkRequired("appliesToPriceIds", appliesToPriceIds).map { it.toImmutable() }, @@ -6406,7 +6292,7 @@ private constructor( private var validated: Boolean = false - fun validate(): UsageDiscountInterval = apply { + fun validate(): Usage = apply { if (validated) { return@apply } @@ -6452,7 +6338,7 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Usage && 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 */ @@ -6462,7 +6348,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "Usage{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -8262,142 +8148,142 @@ private constructor( fun price(price: JsonField) = apply { this.price = price } /** Alias for calling [price] with `Price.ofUnit(unit)`. */ - fun price(unit: Price.UnitPrice) = price(Price.ofUnit(unit)) + fun price(unit: Price.Unit) = price(Price.ofUnit(unit)) - /** Alias for calling [price] with `Price.ofPackagePrice(packagePrice)`. */ - fun price(packagePrice: Price.PackagePrice) = price(Price.ofPackagePrice(packagePrice)) + /** Alias for calling [price] with `Price.ofPackage(package_)`. */ + fun price(package_: Price.Package) = price(Price.ofPackage(package_)) /** Alias for calling [price] with `Price.ofMatrix(matrix)`. */ - fun price(matrix: Price.MatrixPrice) = price(Price.ofMatrix(matrix)) + fun price(matrix: Price.Matrix) = price(Price.ofMatrix(matrix)) /** Alias for calling [price] with `Price.ofTiered(tiered)`. */ - fun price(tiered: Price.TieredPrice) = price(Price.ofTiered(tiered)) + fun price(tiered: Price.Tiered) = price(Price.ofTiered(tiered)) /** Alias for calling [price] with `Price.ofTieredBps(tieredBps)`. */ - fun price(tieredBps: Price.TieredBpsPrice) = price(Price.ofTieredBps(tieredBps)) + fun price(tieredBps: Price.TieredBps) = price(Price.ofTieredBps(tieredBps)) /** Alias for calling [price] with `Price.ofBps(bps)`. */ - fun price(bps: Price.BpsPrice) = price(Price.ofBps(bps)) + fun price(bps: Price.Bps) = price(Price.ofBps(bps)) /** Alias for calling [price] with `Price.ofBulkBps(bulkBps)`. */ - fun price(bulkBps: Price.BulkBpsPrice) = price(Price.ofBulkBps(bulkBps)) + fun price(bulkBps: Price.BulkBps) = price(Price.ofBulkBps(bulkBps)) /** Alias for calling [price] with `Price.ofBulk(bulk)`. */ - fun price(bulk: Price.BulkPrice) = price(Price.ofBulk(bulk)) + fun price(bulk: Price.Bulk) = price(Price.ofBulk(bulk)) /** * Alias for calling [price] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. */ - fun price(thresholdTotalAmount: Price.ThresholdTotalAmountPrice) = + fun price(thresholdTotalAmount: Price.ThresholdTotalAmount) = price(Price.ofThresholdTotalAmount(thresholdTotalAmount)) /** Alias for calling [price] with `Price.ofTieredPackage(tieredPackage)`. */ - fun price(tieredPackage: Price.TieredPackagePrice) = + fun price(tieredPackage: Price.TieredPackage) = price(Price.ofTieredPackage(tieredPackage)) /** Alias for calling [price] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun price(groupedTiered: Price.GroupedTieredPrice) = + fun price(groupedTiered: Price.GroupedTiered) = price(Price.ofGroupedTiered(groupedTiered)) /** Alias for calling [price] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun price(tieredWithMinimum: Price.TieredWithMinimumPrice) = + fun price(tieredWithMinimum: Price.TieredWithMinimum) = price(Price.ofTieredWithMinimum(tieredWithMinimum)) /** * Alias for calling [price] with * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. */ - fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimumPrice) = + fun price(tieredPackageWithMinimum: Price.TieredPackageWithMinimum) = price(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) /** * Alias for calling [price] with * `Price.ofPackageWithAllocation(packageWithAllocation)`. */ - fun price(packageWithAllocation: Price.PackageWithAllocationPrice) = + fun price(packageWithAllocation: Price.PackageWithAllocation) = price(Price.ofPackageWithAllocation(packageWithAllocation)) /** Alias for calling [price] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun price(unitWithPercent: Price.UnitWithPercentPrice) = + fun price(unitWithPercent: Price.UnitWithPercent) = price(Price.ofUnitWithPercent(unitWithPercent)) /** * Alias for calling [price] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. */ - fun price(matrixWithAllocation: Price.MatrixWithAllocationPrice) = + fun price(matrixWithAllocation: Price.MatrixWithAllocation) = price(Price.ofMatrixWithAllocation(matrixWithAllocation)) /** * Alias for calling [price] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun price(tieredWithProration: Price.TieredWithProrationPrice) = + fun price(tieredWithProration: Price.TieredWithProration) = price(Price.ofTieredWithProration(tieredWithProration)) /** Alias for calling [price] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun price(unitWithProration: Price.UnitWithProrationPrice) = + fun price(unitWithProration: Price.UnitWithProration) = price(Price.ofUnitWithProration(unitWithProration)) /** Alias for calling [price] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun price(groupedAllocation: Price.GroupedAllocationPrice) = + fun price(groupedAllocation: Price.GroupedAllocation) = price(Price.ofGroupedAllocation(groupedAllocation)) /** * Alias for calling [price] with * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. */ - fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimumPrice) = + fun price(groupedWithProratedMinimum: Price.GroupedWithProratedMinimum) = price(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) /** * Alias for calling [price] with * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. */ - fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimumPrice) = + fun price(groupedWithMeteredMinimum: Price.GroupedWithMeteredMinimum) = price(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) /** * Alias for calling [price] with * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. */ - fun price(matrixWithDisplayName: Price.MatrixWithDisplayNamePrice) = + fun price(matrixWithDisplayName: Price.MatrixWithDisplayName) = price(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) /** Alias for calling [price] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun price(bulkWithProration: Price.BulkWithProrationPrice) = + fun price(bulkWithProration: Price.BulkWithProration) = price(Price.ofBulkWithProration(bulkWithProration)) /** * Alias for calling [price] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. */ - fun price(groupedTieredPackage: Price.GroupedTieredPackagePrice) = + fun price(groupedTieredPackage: Price.GroupedTieredPackage) = price(Price.ofGroupedTieredPackage(groupedTieredPackage)) /** * Alias for calling [price] with * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. */ - fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackagePrice) = + fun price(maxGroupTieredPackage: Price.MaxGroupTieredPackage) = price(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. */ - fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricingPrice) = + fun price(scalableMatrixWithUnitPricing: Price.ScalableMatrixWithUnitPricing) = price(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) /** * Alias for calling [price] with * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. */ - fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricingPrice) = + fun price(scalableMatrixWithTieredPricing: Price.ScalableMatrixWithTieredPricing) = price(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) /** * Alias for calling [price] with * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. */ - fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulkPrice) = + fun price(cumulativeGroupedBulk: Price.CumulativeGroupedBulk) = price(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) /** diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt index 714fdefff..094ddca46 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponCreateParamsTest.kt @@ -10,7 +10,7 @@ internal class CouponCreateParamsTest { @Test fun create() { CouponCreateParams.builder() - .newCouponPercentageDiscount(0.0) + .percentageDiscount(0.0) .redemptionCode("HALFOFF") .durationInMonths(12L) .maxRedemptions(1L) @@ -21,7 +21,7 @@ internal class CouponCreateParamsTest { fun body() { val params = CouponCreateParams.builder() - .newCouponPercentageDiscount(0.0) + .percentageDiscount(0.0) .redemptionCode("HALFOFF") .durationInMonths(12L) .maxRedemptions(1L) @@ -31,10 +31,8 @@ internal class CouponCreateParamsTest { assertThat(body.discount()) .isEqualTo( - CouponCreateParams.Discount.ofNewCouponPercentage( - CouponCreateParams.Discount.NewCouponPercentageDiscount.builder() - .percentageDiscount(0.0) - .build() + CouponCreateParams.Discount.ofPercentage( + CouponCreateParams.Discount.Percentage.builder().percentageDiscount(0.0).build() ) ) assertThat(body.redemptionCode()).isEqualTo("HALFOFF") @@ -45,19 +43,14 @@ internal class CouponCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - CouponCreateParams.builder() - .newCouponPercentageDiscount(0.0) - .redemptionCode("HALFOFF") - .build() + CouponCreateParams.builder().percentageDiscount(0.0).redemptionCode("HALFOFF").build() val body = params._body() assertThat(body.discount()) .isEqualTo( - CouponCreateParams.Discount.ofNewCouponPercentage( - CouponCreateParams.Discount.NewCouponPercentageDiscount.builder() - .percentageDiscount(0.0) - .build() + CouponCreateParams.Discount.ofPercentage( + CouponCreateParams.Discount.Percentage.builder().percentageDiscount(0.0).build() ) ) assertThat(body.redemptionCode()).isEqualTo("HALFOFF") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt index 8d6ed8158..46c4202e6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt @@ -20,28 +20,26 @@ internal class CustomerCostListByExternalIdResponseTest { .addPerPriceCost( CustomerCostListByExternalIdResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -61,30 +59,27 @@ internal class CustomerCostListByExternalIdResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -92,7 +87,7 @@ internal class CustomerCostListByExternalIdResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -100,14 +95,14 @@ internal class CustomerCostListByExternalIdResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -136,26 +131,25 @@ internal class CustomerCostListByExternalIdResponseTest { .addPerPriceCost( CustomerCostListByExternalIdResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -175,32 +169,29 @@ internal class CustomerCostListByExternalIdResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -208,14 +199,14 @@ internal class CustomerCostListByExternalIdResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -246,28 +237,26 @@ internal class CustomerCostListByExternalIdResponseTest { .addPerPriceCost( CustomerCostListByExternalIdResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -287,30 +276,27 @@ internal class CustomerCostListByExternalIdResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -318,7 +304,7 @@ internal class CustomerCostListByExternalIdResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -326,14 +312,14 @@ internal class CustomerCostListByExternalIdResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt index 53f33b445..764e48e3e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt @@ -20,28 +20,26 @@ internal class CustomerCostListResponseTest { .addPerPriceCost( CustomerCostListResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -61,30 +59,27 @@ internal class CustomerCostListResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -92,7 +87,7 @@ internal class CustomerCostListResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -100,14 +95,14 @@ internal class CustomerCostListResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -136,26 +131,25 @@ internal class CustomerCostListResponseTest { .addPerPriceCost( CustomerCostListResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -175,32 +169,29 @@ internal class CustomerCostListResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -208,14 +199,14 @@ internal class CustomerCostListResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -246,28 +237,26 @@ internal class CustomerCostListResponseTest { .addPerPriceCost( CustomerCostListResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -287,30 +276,27 @@ internal class CustomerCostListResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -318,7 +304,7 @@ internal class CustomerCostListResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -326,14 +312,14 @@ internal class CustomerCostListResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt index ec57e32de..f1bef4be0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt @@ -68,7 +68,7 @@ internal class CustomerCreateParamsTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -144,7 +144,7 @@ internal class CustomerCreateParamsTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -222,8 +222,8 @@ internal class CustomerCreateParamsTest { ) assertThat(body.taxConfiguration()) .contains( - CustomerCreateParams.TaxConfiguration.ofNewAvalara( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerCreateParams.TaxConfiguration.ofAvalara( + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt index b914f7374..547cfd51e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt @@ -14,17 +14,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") .body( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .InvoiceSettings .builder() .autoCollection(true) @@ -34,9 +31,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -52,7 +47,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { val params = CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") - .addIncrementCreditLedgerEntryRequestParamsBody(0.0) + .incrementBody(0.0) .build() assertThat(params._pathParam(0)).isEqualTo("external_customer_id") @@ -66,17 +61,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") .body( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .InvoiceSettings .builder() .autoCollection(true) @@ -86,8 +78,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -102,38 +93,33 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { assertThat(body) .isEqualTo( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .ofAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() - .amount(0.0) - .currency("currency") - .description("description") - .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .InvoiceSettings - .builder() - .autoCollection(true) - .netTerms(0L) - .memo("memo") - .requireSuccessfulPayment(true) - .build() - ) - .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata - .builder() - .putAdditionalProperty("foo", JsonValue.from("string")) - .build() - ) - .perUnitCostBasis("per_unit_cost_basis") - .build() - ) + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.ofIncrement( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.builder() + .amount(0.0) + .currency("currency") + .description("description") + .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .invoiceSettings( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment + .InvoiceSettings + .builder() + .autoCollection(true) + .netTerms(0L) + .memo("memo") + .requireSuccessfulPayment(true) + .build() + ) + .metadata( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .perUnitCostBasis("per_unit_cost_basis") + .build() + ) ) } @@ -142,21 +128,18 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { val params = CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") - .addIncrementCreditLedgerEntryRequestParamsBody(0.0) + .incrementBody(0.0) .build() val body = params._body() assertThat(body) .isEqualTo( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .ofAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() - .amount(0.0) - .build() - ) + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.ofIncrement( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.builder() + .amount(0.0) + .build() + ) ) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt index f9508d502..88eb36d02 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt @@ -16,15 +16,14 @@ import org.junit.jupiter.params.provider.EnumSource internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { @Test - fun ofIncrementLedgerEntry() { - val incrementLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry.builder() + fun ofIncrement() { + val increment = + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -33,9 +32,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .Customer - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -43,15 +40,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .Metadata - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -59,41 +53,29 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofIncrementLedgerEntry( - incrementLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .contains(incrementLedgerEntry) - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .isEmpty + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofIncrement(increment) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()) + .contains(increment) + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()).isEmpty } @Test - fun ofIncrementLedgerEntryRoundtrip() { + fun ofIncrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofIncrementLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofIncrement( + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -102,8 +84,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -112,14 +93,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.IncrementLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -139,15 +118,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { } @Test - fun ofDecrementLedgerEntry() { - val decrementLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry.builder() + fun ofDecrement() { + val decrement = + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -156,9 +134,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .Customer - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -166,15 +142,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .Metadata - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -185,41 +158,29 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofDecrementLedgerEntry( - decrementLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .contains(decrementLedgerEntry) - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .isEmpty + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofDecrement(decrement) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()) + .contains(decrement) + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()).isEmpty } @Test - fun ofDecrementLedgerEntryRoundtrip() { + fun ofDecrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofDecrementLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry.builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofDecrement( + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -228,8 +189,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -238,14 +198,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.DecrementLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.Decrement.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -268,16 +226,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { } @Test - fun ofExpirationChangeLedgerEntry() { - val expirationChangeLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .builder() + fun ofExpirationChange() { + val expirationChange = + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -286,8 +242,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -296,14 +251,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -313,42 +266,29 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .contains(expirationChangeLedgerEntry) - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .isEmpty + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofExpirationChange(expirationChange) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()) + .contains(expirationChange) + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()).isEmpty } @Test - fun ofExpirationChangeLedgerEntryRoundtrip() { + fun ofExpirationChangeRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofExpirationChangeLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChangeLedgerEntry - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofExpirationChange( + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .ExpirationChangeLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange .CreditBlock .builder() .id("id") @@ -358,8 +298,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .ExpirationChangeLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange .Customer .builder() .id("id") @@ -369,15 +308,13 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .ExpirationChangeLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange .EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .ExpirationChangeLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.ExpirationChange .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -399,15 +336,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { } @Test - fun ofCreditBlockExpiryLedgerEntry() { - val creditBlockExpiryLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry - .builder() + fun ofCreditBlockExpiry() { + val creditBlockExpiry = + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry .CreditBlock .builder() .id("id") @@ -417,8 +353,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -427,14 +362,13 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry .EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -443,42 +377,31 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .contains(creditBlockExpiryLedgerEntry) - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .isEmpty + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofCreditBlockExpiry( + creditBlockExpiry + ) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()) + .contains(creditBlockExpiry) + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()).isEmpty } @Test - fun ofCreditBlockExpiryLedgerEntryRoundtrip() { + fun ofCreditBlockExpiryRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofCreditBlockExpiryLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiryLedgerEntry - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofCreditBlockExpiry( + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .CreditBlockExpiryLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry .CreditBlock .builder() .id("id") @@ -488,8 +411,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .CreditBlockExpiryLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry .Customer .builder() .id("id") @@ -499,15 +421,13 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .CreditBlockExpiryLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry .EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse - .CreditBlockExpiryLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.CreditBlockExpiry .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -528,15 +448,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { } @Test - fun ofVoidLedgerEntry() { - val voidLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.builder() + fun ofVoid() { + val void_ = + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -544,8 +463,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -553,13 +471,11 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -569,40 +485,28 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoidLedgerEntry(voidLedgerEntry) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()) - .contains(voidLedgerEntry) - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .isEmpty + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoid(void_) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).contains(void_) + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()).isEmpty } @Test - fun ofVoidLedgerEntryRoundtrip() { + fun ofVoidRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoidLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoid( + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -611,8 +515,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -620,14 +523,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -648,15 +549,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { } @Test - fun ofVoidInitiatedLedgerEntry() { - val voidInitiatedLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry.builder() + fun ofVoidInitiated() { + val voidInitiated = + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -665,8 +565,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -675,14 +574,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -694,41 +591,29 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .contains(voidInitiatedLedgerEntry) - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .isEmpty + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoidInitiated(voidInitiated) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()) + .contains(voidInitiated) + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()).isEmpty } @Test - fun ofVoidInitiatedLedgerEntryRoundtrip() { + fun ofVoidInitiatedRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoidInitiatedLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofVoidInitiated( + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated .CreditBlock .builder() .id("id") @@ -738,8 +623,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -748,14 +632,13 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated .EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiatedLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.VoidInitiated.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -778,15 +661,14 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { } @Test - fun ofAmendmentLedgerEntry() { - val amendmentLedgerEntry = - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry.builder() + fun ofAmendment() { + val amendment = + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -795,9 +677,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .Customer - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -805,15 +685,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .Metadata - .builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -821,41 +698,29 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .build() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofAmendmentLedgerEntry( - amendmentLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.incrementLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrementLedgerEntry()) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.expirationChangeLedgerEntry() - ) - .isEmpty - assertThat( - customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiryLedgerEntry() - ) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiatedLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendmentLedgerEntry()) - .contains(amendmentLedgerEntry) + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofAmendment(amendment) + + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryByExternalIdResponse.amendment()) + .contains(amendment) } @Test - fun ofAmendmentLedgerEntryRoundtrip() { + fun ofAmendmentRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryByExternalIdResponse = - CustomerCreditLedgerCreateEntryByExternalIdResponse.ofAmendmentLedgerEntry( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry.builder() + CustomerCreditLedgerCreateEntryByExternalIdResponse.ofAmendment( + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -864,8 +729,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .Customer + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -874,14 +738,12 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdResponse.AmendmentLedgerEntry - .Metadata + CustomerCreditLedgerCreateEntryByExternalIdResponse.Amendment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt index 74e6fd5cc..2296b12a4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt @@ -14,18 +14,14 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") .body( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .InvoiceSettings + CustomerCreditLedgerCreateEntryParams.Body.Increment.InvoiceSettings .builder() .autoCollection(true) .netTerms(0L) @@ -34,10 +30,7 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata - .builder() + CustomerCreditLedgerCreateEntryParams.Body.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -52,7 +45,7 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { val params = CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") - .addIncrementCreditLedgerEntryRequestParamsBody(0.0) + .incrementBody(0.0) .build() assertThat(params._pathParam(0)).isEqualTo("customer_id") @@ -66,18 +59,14 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") .body( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .InvoiceSettings + CustomerCreditLedgerCreateEntryParams.Body.Increment.InvoiceSettings .builder() .autoCollection(true) .netTerms(0L) @@ -86,10 +75,7 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata - .builder() + CustomerCreditLedgerCreateEntryParams.Body.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -102,38 +88,30 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { assertThat(body) .isEqualTo( - CustomerCreditLedgerCreateEntryParams.Body - .ofAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() - .amount(0.0) - .currency("currency") - .description("description") - .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .invoiceSettings( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .InvoiceSettings - .builder() - .autoCollection(true) - .netTerms(0L) - .memo("memo") - .requireSuccessfulPayment(true) - .build() - ) - .metadata( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata - .builder() - .putAdditionalProperty("foo", JsonValue.from("string")) - .build() - ) - .perUnitCostBasis("per_unit_cost_basis") - .build() - ) + CustomerCreditLedgerCreateEntryParams.Body.ofIncrement( + CustomerCreditLedgerCreateEntryParams.Body.Increment.builder() + .amount(0.0) + .currency("currency") + .description("description") + .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .invoiceSettings( + CustomerCreditLedgerCreateEntryParams.Body.Increment.InvoiceSettings + .builder() + .autoCollection(true) + .netTerms(0L) + .memo("memo") + .requireSuccessfulPayment(true) + .build() + ) + .metadata( + CustomerCreditLedgerCreateEntryParams.Body.Increment.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .perUnitCostBasis("per_unit_cost_basis") + .build() + ) ) } @@ -142,21 +120,18 @@ internal class CustomerCreditLedgerCreateEntryParamsTest { val params = CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") - .addIncrementCreditLedgerEntryRequestParamsBody(0.0) + .incrementBody(0.0) .build() val body = params._body() assertThat(body) .isEqualTo( - CustomerCreditLedgerCreateEntryParams.Body - .ofAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() - .amount(0.0) - .build() - ) + CustomerCreditLedgerCreateEntryParams.Body.ofIncrement( + CustomerCreditLedgerCreateEntryParams.Body.Increment.builder() + .amount(0.0) + .build() + ) ) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt index 8b2c1ac9c..7e8132525 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt @@ -16,15 +16,14 @@ import org.junit.jupiter.params.provider.EnumSource internal class CustomerCreditLedgerCreateEntryResponseTest { @Test - fun ofIncrementLedgerEntry() { - val incrementLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.builder() + fun ofIncrement() { + val increment = + CustomerCreditLedgerCreateEntryResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -32,7 +31,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.Customer.builder() + CustomerCreditLedgerCreateEntryResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -40,12 +39,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerCreateEntryResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -53,30 +51,28 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofIncrementLedgerEntry(incrementLedgerEntry) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()) - .contains(incrementLedgerEntry) - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerCreateEntryResponse.ofIncrement(increment) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).contains(increment) + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).isEmpty } @Test - fun ofIncrementLedgerEntryRoundtrip() { + fun ofIncrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofIncrementLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofIncrement( + CustomerCreditLedgerCreateEntryResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -84,8 +80,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -93,13 +88,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.IncrementLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -118,15 +111,14 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { } @Test - fun ofDecrementLedgerEntry() { - val decrementLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.builder() + fun ofDecrement() { + val decrement = + CustomerCreditLedgerCreateEntryResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Decrement.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -134,7 +126,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.Customer.builder() + CustomerCreditLedgerCreateEntryResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -142,12 +134,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.Decrement.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerCreateEntryResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -158,30 +149,28 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofDecrementLedgerEntry(decrementLedgerEntry) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()) - .contains(decrementLedgerEntry) - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerCreateEntryResponse.ofDecrement(decrement) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).contains(decrement) + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).isEmpty } @Test - fun ofDecrementLedgerEntryRoundtrip() { + fun ofDecrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofDecrementLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofDecrement( + CustomerCreditLedgerCreateEntryResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Decrement.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -189,8 +178,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -198,13 +186,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.Decrement.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.DecrementLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -226,15 +212,14 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { } @Test - fun ofExpirationChangeLedgerEntry() { - val expirationChangeLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.builder() + fun ofExpirationChange() { + val expirationChange = + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -242,8 +227,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -251,13 +235,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -266,32 +248,29 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()) - .contains(expirationChangeLedgerEntry) - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerCreateEntryResponse.ofExpirationChange(expirationChange) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()) + .contains(expirationChange) + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).isEmpty } @Test - fun ofExpirationChangeLedgerEntryRoundtrip() { + fun ofExpirationChangeRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofExpirationChangeLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofExpirationChange( + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -300,8 +279,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -309,14 +287,12 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.ExpirationChangeLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.ExpirationChange.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -336,15 +312,14 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { } @Test - fun ofCreditBlockExpiryLedgerEntry() { - val creditBlockExpiryLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.builder() + fun ofCreditBlockExpiry() { + val creditBlockExpiry = + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -352,8 +327,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -361,13 +335,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -375,32 +347,29 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()) - .contains(creditBlockExpiryLedgerEntry) - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerCreateEntryResponse.ofCreditBlockExpiry(creditBlockExpiry) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()) + .contains(creditBlockExpiry) + assertThat(customerCreditLedgerCreateEntryResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).isEmpty } @Test - fun ofCreditBlockExpiryLedgerEntryRoundtrip() { + fun ofCreditBlockExpiryRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofCreditBlockExpiryLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofCreditBlockExpiry( + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry - .CreditBlock + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -409,9 +378,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry - .Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -419,15 +386,12 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry - .EntryStatus + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiryLedgerEntry - .Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.CreditBlockExpiry.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -446,14 +410,14 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { } @Test - fun ofVoidLedgerEntry() { - val voidLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.builder() + fun ofVoid() { + val void_ = + CustomerCreditLedgerCreateEntryResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerCreateEntryResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -461,19 +425,17 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.Customer.builder() + CustomerCreditLedgerCreateEntryResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerCreateEntryResponse.Void.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.Metadata.builder() + CustomerCreditLedgerCreateEntryResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -483,30 +445,28 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofVoidLedgerEntry(voidLedgerEntry) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()) - .contains(voidLedgerEntry) - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerCreateEntryResponse.ofVoid(void_) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.void_()).contains(void_) + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).isEmpty } @Test - fun ofVoidLedgerEntryRoundtrip() { + fun ofVoidRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofVoidLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofVoid( + CustomerCreditLedgerCreateEntryResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -514,20 +474,17 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.Customer.builder() + CustomerCreditLedgerCreateEntryResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.EntryStatus - .COMMITTED - ) + .entryStatus(CustomerCreditLedgerCreateEntryResponse.Void.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.VoidLedgerEntry.Metadata.builder() + CustomerCreditLedgerCreateEntryResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -548,15 +505,14 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { } @Test - fun ofVoidInitiatedLedgerEntry() { - val voidInitiatedLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.builder() + fun ofVoidInitiated() { + val voidInitiated = + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -564,8 +520,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -573,13 +528,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -590,32 +543,28 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry - ) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()) - .contains(voidInitiatedLedgerEntry) - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerCreateEntryResponse.ofVoidInitiated(voidInitiated) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).contains(voidInitiated) + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).isEmpty } @Test - fun ofVoidInitiatedLedgerEntryRoundtrip() { + fun ofVoidInitiatedRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofVoidInitiatedLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofVoidInitiated( + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -623,8 +572,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -632,13 +580,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.VoidInitiatedLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.VoidInitiated.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -660,15 +606,14 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { } @Test - fun ofAmendmentLedgerEntry() { - val amendmentLedgerEntry = - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.builder() + fun ofAmendment() { + val amendment = + CustomerCreditLedgerCreateEntryResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Amendment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -676,7 +621,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.Customer.builder() + CustomerCreditLedgerCreateEntryResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -684,12 +629,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.Amendment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.Metadata.builder() + CustomerCreditLedgerCreateEntryResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -697,30 +641,28 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .build() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofAmendmentLedgerEntry(amendmentLedgerEntry) - - assertThat(customerCreditLedgerCreateEntryResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerCreateEntryResponse.amendmentLedgerEntry()) - .contains(amendmentLedgerEntry) + CustomerCreditLedgerCreateEntryResponse.ofAmendment(amendment) + + assertThat(customerCreditLedgerCreateEntryResponse.increment()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.decrement()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.void_()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerCreateEntryResponse.amendment()).contains(amendment) } @Test - fun ofAmendmentLedgerEntryRoundtrip() { + fun ofAmendmentRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerCreateEntryResponse = - CustomerCreditLedgerCreateEntryResponse.ofAmendmentLedgerEntry( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.builder() + CustomerCreditLedgerCreateEntryResponse.ofAmendment( + CustomerCreditLedgerCreateEntryResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerCreateEntryResponse.Amendment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -728,8 +670,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.Customer - .builder() + CustomerCreditLedgerCreateEntryResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -737,13 +678,11 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerCreateEntryResponse.Amendment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerCreateEntryResponse.AmendmentLedgerEntry.Metadata - .builder() + CustomerCreditLedgerCreateEntryResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt index 50d4e0205..be1f12c7c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt @@ -16,13 +16,12 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { val customerCreditLedgerListByExternalIdPageResponse = CustomerCreditLedgerListByExternalIdPageResponse.builder() .addData( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.Increment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -31,8 +30,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.Increment.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -41,14 +39,12 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.Increment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -63,14 +59,13 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { assertThat(customerCreditLedgerListByExternalIdPageResponse.data()) .containsExactly( - CustomerCreditLedgerListByExternalIdResponse.ofIncrementLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofIncrement( + CustomerCreditLedgerListByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.Increment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -79,8 +74,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.Increment.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -89,14 +83,12 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.Increment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -115,13 +107,12 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { val customerCreditLedgerListByExternalIdPageResponse = CustomerCreditLedgerListByExternalIdPageResponse.builder() .addData( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.Increment.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -130,8 +121,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.Increment.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -140,14 +130,12 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.Increment.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt index c30d302b4..3e0493211 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt @@ -16,15 +16,14 @@ import org.junit.jupiter.params.provider.EnumSource internal class CustomerCreditLedgerListByExternalIdResponseTest { @Test - fun ofIncrementLedgerEntry() { - val incrementLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.builder() + fun ofIncrement() { + val increment = + CustomerCreditLedgerListByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -32,8 +31,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -41,13 +39,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -55,35 +51,28 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofIncrementLedgerEntry( - incrementLedgerEntry - ) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()) - .contains(incrementLedgerEntry) - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListByExternalIdResponse.ofIncrement(increment) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).contains(increment) + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).isEmpty } @Test - fun ofIncrementLedgerEntryRoundtrip() { + fun ofIncrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofIncrementLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofIncrement( + CustomerCreditLedgerListByExternalIdResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -91,8 +80,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -100,14 +88,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry - .EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.IncrementLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -126,15 +111,14 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { } @Test - fun ofDecrementLedgerEntry() { - val decrementLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.builder() + fun ofDecrement() { + val decrement = + CustomerCreditLedgerListByExternalIdResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Decrement.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -142,8 +126,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -151,13 +134,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Decrement.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -168,35 +149,28 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofDecrementLedgerEntry( - decrementLedgerEntry - ) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()) - .contains(decrementLedgerEntry) - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListByExternalIdResponse.ofDecrement(decrement) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).contains(decrement) + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).isEmpty } @Test - fun ofDecrementLedgerEntryRoundtrip() { + fun ofDecrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofDecrementLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofDecrement( + CustomerCreditLedgerListByExternalIdResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry - .CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Decrement.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -204,8 +178,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -213,14 +186,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry - .EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Decrement.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.DecrementLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -242,15 +212,14 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { } @Test - fun ofExpirationChangeLedgerEntry() { - val expirationChangeLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry.builder() + fun ofExpirationChange() { + val expirationChange = + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -259,9 +228,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -269,15 +236,12 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -286,33 +250,29 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry - ) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .contains(expirationChangeLedgerEntry) - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListByExternalIdResponse.ofExpirationChange(expirationChange) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()) + .contains(expirationChange) + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).isEmpty } @Test - fun ofExpirationChangeLedgerEntryRoundtrip() { + fun ofExpirationChangeRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofExpirationChangeLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofExpirationChange( + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -321,8 +281,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -331,14 +290,12 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.ExpirationChangeLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.ExpirationChange.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -359,15 +316,14 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { } @Test - fun ofCreditBlockExpiryLedgerEntry() { - val creditBlockExpiryLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry.builder() + fun ofCreditBlockExpiry() { + val creditBlockExpiry = + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -376,8 +332,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -386,14 +341,12 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -402,33 +355,29 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry - ) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .contains(creditBlockExpiryLedgerEntry) - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiry(creditBlockExpiry) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()) + .contains(creditBlockExpiry) + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).isEmpty } @Test - fun ofCreditBlockExpiryLedgerEntryRoundtrip() { + fun ofCreditBlockExpiryRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiryLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofCreditBlockExpiry( + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -437,8 +386,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -447,14 +395,12 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiryLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.CreditBlockExpiry.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -474,15 +420,14 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { } @Test - fun ofVoidLedgerEntry() { - val voidLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.builder() + fun ofVoid() { + val void_ = + CustomerCreditLedgerListByExternalIdResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -490,7 +435,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.Customer.builder() + CustomerCreditLedgerListByExternalIdResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -498,12 +443,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Void.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.Metadata.builder() + CustomerCreditLedgerListByExternalIdResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -513,32 +457,28 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofVoidLedgerEntry(voidLedgerEntry) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()) - .contains(voidLedgerEntry) - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListByExternalIdResponse.ofVoid(void_) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).contains(void_) + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).isEmpty } @Test - fun ofVoidLedgerEntryRoundtrip() { + fun ofVoidRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofVoidLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofVoid( + CustomerCreditLedgerListByExternalIdResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -546,8 +486,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -555,13 +494,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Void.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.VoidLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -582,16 +519,14 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { } @Test - fun ofVoidInitiatedLedgerEntry() { - val voidInitiatedLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry.builder() + fun ofVoidInitiated() { + val voidInitiated = + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -599,8 +534,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -608,14 +542,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -626,34 +557,29 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiatedLedgerEntry( - voidInitiatedLedgerEntry - ) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()) - .contains(voidInitiatedLedgerEntry) - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiated(voidInitiated) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()) + .contains(voidInitiated) + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).isEmpty } @Test - fun ofVoidInitiatedLedgerEntryRoundtrip() { + fun ofVoidInitiatedRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiatedLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofVoidInitiated( + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .CreditBlock + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.CreditBlock .builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -662,8 +588,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .Customer + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.Customer .builder() .id("id") .externalCustomerId("external_customer_id") @@ -672,14 +597,12 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .EntryStatus + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.EntryStatus .COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.VoidInitiatedLedgerEntry - .Metadata + CustomerCreditLedgerListByExternalIdResponse.VoidInitiated.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -702,15 +625,14 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { } @Test - fun ofAmendmentLedgerEntry() { - val amendmentLedgerEntry = - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.builder() + fun ofAmendment() { + val amendment = + CustomerCreditLedgerListByExternalIdResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Amendment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -718,8 +640,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -727,13 +648,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Amendment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -741,35 +660,28 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .build() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofAmendmentLedgerEntry( - amendmentLedgerEntry - ) - - assertThat(customerCreditLedgerListByExternalIdResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.expirationChangeLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiryLedgerEntry()) - .isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListByExternalIdResponse.amendmentLedgerEntry()) - .contains(amendmentLedgerEntry) + CustomerCreditLedgerListByExternalIdResponse.ofAmendment(amendment) + + assertThat(customerCreditLedgerListByExternalIdResponse.increment()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.void_()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListByExternalIdResponse.amendment()).contains(amendment) } @Test - fun ofAmendmentLedgerEntryRoundtrip() { + fun ofAmendmentRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListByExternalIdResponse = - CustomerCreditLedgerListByExternalIdResponse.ofAmendmentLedgerEntry( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.builder() + CustomerCreditLedgerListByExternalIdResponse.ofAmendment( + CustomerCreditLedgerListByExternalIdResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry - .CreditBlock - .builder() + CustomerCreditLedgerListByExternalIdResponse.Amendment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -777,8 +689,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.Customer - .builder() + CustomerCreditLedgerListByExternalIdResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -786,14 +697,11 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry - .EntryStatus - .COMMITTED + CustomerCreditLedgerListByExternalIdResponse.Amendment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListByExternalIdResponse.AmendmentLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListByExternalIdResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt index c72b97c18..0fa1974e7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt @@ -16,13 +16,12 @@ internal class CustomerCreditLedgerListPageResponseTest { val customerCreditLedgerListPageResponse = CustomerCreditLedgerListPageResponse.builder() .addData( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -30,7 +29,7 @@ internal class CustomerCreditLedgerListPageResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -38,12 +37,11 @@ internal class CustomerCreditLedgerListPageResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -57,14 +55,13 @@ internal class CustomerCreditLedgerListPageResponseTest { assertThat(customerCreditLedgerListPageResponse.data()) .containsExactly( - CustomerCreditLedgerListResponse.ofIncrementLedgerEntry( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofIncrement( + CustomerCreditLedgerListResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -72,7 +69,7 @@ internal class CustomerCreditLedgerListPageResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -80,12 +77,11 @@ internal class CustomerCreditLedgerListPageResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -103,13 +99,12 @@ internal class CustomerCreditLedgerListPageResponseTest { val customerCreditLedgerListPageResponse = CustomerCreditLedgerListPageResponse.builder() .addData( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -117,7 +112,7 @@ internal class CustomerCreditLedgerListPageResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -125,12 +120,11 @@ internal class CustomerCreditLedgerListPageResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.Increment.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt index 536d143f9..fb6f10251 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt @@ -16,14 +16,14 @@ import org.junit.jupiter.params.provider.EnumSource internal class CustomerCreditLedgerListResponseTest { @Test - fun ofIncrementLedgerEntry() { - val incrementLedgerEntry = - CustomerCreditLedgerListResponse.IncrementLedgerEntry.builder() + fun ofIncrement() { + val increment = + CustomerCreditLedgerListResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -31,19 +31,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Increment.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -51,29 +49,28 @@ internal class CustomerCreditLedgerListResponseTest { .build() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofIncrementLedgerEntry(incrementLedgerEntry) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()) - .contains(incrementLedgerEntry) - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListResponse.ofIncrement(increment) + + assertThat(customerCreditLedgerListResponse.increment()).contains(increment) + assertThat(customerCreditLedgerListResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListResponse.void_()).isEmpty + assertThat(customerCreditLedgerListResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListResponse.amendment()).isEmpty } @Test - fun ofIncrementLedgerEntryRoundtrip() { + fun ofIncrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofIncrementLedgerEntry( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofIncrement( + CustomerCreditLedgerListResponse.Increment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Increment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -81,19 +78,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Increment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Increment.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.IncrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Increment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -112,14 +107,14 @@ internal class CustomerCreditLedgerListResponseTest { } @Test - fun ofDecrementLedgerEntry() { - val decrementLedgerEntry = - CustomerCreditLedgerListResponse.DecrementLedgerEntry.builder() + fun ofDecrement() { + val decrement = + CustomerCreditLedgerListResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Decrement.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -127,19 +122,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Decrement.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -150,29 +143,28 @@ internal class CustomerCreditLedgerListResponseTest { .build() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofDecrementLedgerEntry(decrementLedgerEntry) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()) - .contains(decrementLedgerEntry) - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListResponse.ofDecrement(decrement) + + assertThat(customerCreditLedgerListResponse.increment()).isEmpty + assertThat(customerCreditLedgerListResponse.decrement()).contains(decrement) + assertThat(customerCreditLedgerListResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListResponse.void_()).isEmpty + assertThat(customerCreditLedgerListResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListResponse.amendment()).isEmpty } @Test - fun ofDecrementLedgerEntryRoundtrip() { + fun ofDecrementRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofDecrementLedgerEntry( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofDecrement( + CustomerCreditLedgerListResponse.Decrement.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Decrement.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -180,19 +172,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Decrement.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Decrement.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.DecrementLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Decrement.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -214,15 +204,14 @@ internal class CustomerCreditLedgerListResponseTest { } @Test - fun ofExpirationChangeLedgerEntry() { - val expirationChangeLedgerEntry = - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.builder() + fun ofExpirationChange() { + val expirationChange = + CustomerCreditLedgerListResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.ExpirationChange.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -230,7 +219,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.ExpirationChange.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -238,12 +227,11 @@ internal class CustomerCreditLedgerListResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.ExpirationChange.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.ExpirationChange.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -252,32 +240,28 @@ internal class CustomerCreditLedgerListResponseTest { .build() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofExpirationChangeLedgerEntry( - expirationChangeLedgerEntry - ) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()) - .contains(expirationChangeLedgerEntry) - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListResponse.ofExpirationChange(expirationChange) + + assertThat(customerCreditLedgerListResponse.increment()).isEmpty + assertThat(customerCreditLedgerListResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListResponse.expirationChange()).contains(expirationChange) + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListResponse.void_()).isEmpty + assertThat(customerCreditLedgerListResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListResponse.amendment()).isEmpty } @Test - fun ofExpirationChangeLedgerEntryRoundtrip() { + fun ofExpirationChangeRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofExpirationChangeLedgerEntry( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofExpirationChange( + CustomerCreditLedgerListResponse.ExpirationChange.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.ExpirationChange.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -285,8 +269,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.Customer - .builder() + CustomerCreditLedgerListResponse.ExpirationChange.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -294,13 +277,11 @@ internal class CustomerCreditLedgerListResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.ExpirationChange.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.ExpirationChangeLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListResponse.ExpirationChange.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -320,15 +301,14 @@ internal class CustomerCreditLedgerListResponseTest { } @Test - fun ofCreditBlockExpiryLedgerEntry() { - val creditBlockExpiryLedgerEntry = - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.builder() + fun ofCreditBlockExpiry() { + val creditBlockExpiry = + CustomerCreditLedgerListResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.CreditBlockExpiry.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -336,7 +316,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.CreditBlockExpiry.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -344,12 +324,11 @@ internal class CustomerCreditLedgerListResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.CreditBlockExpiry.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.CreditBlockExpiry.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -357,32 +336,28 @@ internal class CustomerCreditLedgerListResponseTest { .build() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofCreditBlockExpiryLedgerEntry( - creditBlockExpiryLedgerEntry - ) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()) - .contains(creditBlockExpiryLedgerEntry) - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListResponse.ofCreditBlockExpiry(creditBlockExpiry) + + assertThat(customerCreditLedgerListResponse.increment()).isEmpty + assertThat(customerCreditLedgerListResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).contains(creditBlockExpiry) + assertThat(customerCreditLedgerListResponse.void_()).isEmpty + assertThat(customerCreditLedgerListResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListResponse.amendment()).isEmpty } @Test - fun ofCreditBlockExpiryLedgerEntryRoundtrip() { + fun ofCreditBlockExpiryRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofCreditBlockExpiryLedgerEntry( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofCreditBlockExpiry( + CustomerCreditLedgerListResponse.CreditBlockExpiry.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.CreditBlockExpiry.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -390,8 +365,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.Customer - .builder() + CustomerCreditLedgerListResponse.CreditBlockExpiry.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -399,13 +373,11 @@ internal class CustomerCreditLedgerListResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.CreditBlockExpiry.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.CreditBlockExpiryLedgerEntry.Metadata - .builder() + CustomerCreditLedgerListResponse.CreditBlockExpiry.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -424,14 +396,14 @@ internal class CustomerCreditLedgerListResponseTest { } @Test - fun ofVoidLedgerEntry() { - val voidLedgerEntry = - CustomerCreditLedgerListResponse.VoidLedgerEntry.builder() + fun ofVoid() { + val void_ = + CustomerCreditLedgerListResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.VoidLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -439,17 +411,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.VoidLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus(CustomerCreditLedgerListResponse.VoidLedgerEntry.EntryStatus.COMMITTED) + .entryStatus(CustomerCreditLedgerListResponse.Void.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.VoidLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -458,29 +430,28 @@ internal class CustomerCreditLedgerListResponseTest { .voidReason("void_reason") .build() - val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofVoidLedgerEntry(voidLedgerEntry) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).contains(voidLedgerEntry) - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()).isEmpty + val customerCreditLedgerListResponse = CustomerCreditLedgerListResponse.ofVoid(void_) + + assertThat(customerCreditLedgerListResponse.increment()).isEmpty + assertThat(customerCreditLedgerListResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListResponse.void_()).contains(void_) + assertThat(customerCreditLedgerListResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListResponse.amendment()).isEmpty } @Test - fun ofVoidLedgerEntryRoundtrip() { + fun ofVoidRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofVoidLedgerEntry( - CustomerCreditLedgerListResponse.VoidLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofVoid( + CustomerCreditLedgerListResponse.Void.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.VoidLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Void.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -488,19 +459,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.VoidLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Void.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.VoidLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Void.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.VoidLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Void.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -521,14 +490,14 @@ internal class CustomerCreditLedgerListResponseTest { } @Test - fun ofVoidInitiatedLedgerEntry() { - val voidInitiatedLedgerEntry = - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.builder() + fun ofVoidInitiated() { + val voidInitiated = + CustomerCreditLedgerListResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.VoidInitiated.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -536,19 +505,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.VoidInitiated.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.VoidInitiated.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.VoidInitiated.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -559,30 +526,28 @@ internal class CustomerCreditLedgerListResponseTest { .build() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofVoidInitiatedLedgerEntry(voidInitiatedLedgerEntry) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()) - .contains(voidInitiatedLedgerEntry) - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()).isEmpty + CustomerCreditLedgerListResponse.ofVoidInitiated(voidInitiated) + + assertThat(customerCreditLedgerListResponse.increment()).isEmpty + assertThat(customerCreditLedgerListResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListResponse.void_()).isEmpty + assertThat(customerCreditLedgerListResponse.voidInitiated()).contains(voidInitiated) + assertThat(customerCreditLedgerListResponse.amendment()).isEmpty } @Test - fun ofVoidInitiatedLedgerEntryRoundtrip() { + fun ofVoidInitiatedRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofVoidInitiatedLedgerEntry( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofVoidInitiated( + CustomerCreditLedgerListResponse.VoidInitiated.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.CreditBlock - .builder() + CustomerCreditLedgerListResponse.VoidInitiated.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -590,7 +555,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.VoidInitiated.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() @@ -598,12 +563,11 @@ internal class CustomerCreditLedgerListResponseTest { .description("description") .endingBalance(0.0) .entryStatus( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.EntryStatus - .COMMITTED + CustomerCreditLedgerListResponse.VoidInitiated.EntryStatus.COMMITTED ) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.VoidInitiatedLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.VoidInitiated.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -625,14 +589,14 @@ internal class CustomerCreditLedgerListResponseTest { } @Test - fun ofAmendmentLedgerEntry() { - val amendmentLedgerEntry = - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.builder() + fun ofAmendment() { + val amendment = + CustomerCreditLedgerListResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Amendment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -640,19 +604,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Amendment.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -660,29 +622,28 @@ internal class CustomerCreditLedgerListResponseTest { .build() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofAmendmentLedgerEntry(amendmentLedgerEntry) - - assertThat(customerCreditLedgerListResponse.incrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.decrementLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.expirationChangeLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.creditBlockExpiryLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.voidInitiatedLedgerEntry()).isEmpty - assertThat(customerCreditLedgerListResponse.amendmentLedgerEntry()) - .contains(amendmentLedgerEntry) + CustomerCreditLedgerListResponse.ofAmendment(amendment) + + assertThat(customerCreditLedgerListResponse.increment()).isEmpty + assertThat(customerCreditLedgerListResponse.decrement()).isEmpty + assertThat(customerCreditLedgerListResponse.expirationChange()).isEmpty + assertThat(customerCreditLedgerListResponse.creditBlockExpiry()).isEmpty + assertThat(customerCreditLedgerListResponse.void_()).isEmpty + assertThat(customerCreditLedgerListResponse.voidInitiated()).isEmpty + assertThat(customerCreditLedgerListResponse.amendment()).contains(amendment) } @Test - fun ofAmendmentLedgerEntryRoundtrip() { + fun ofAmendmentRoundtrip() { val jsonMapper = jsonMapper() val customerCreditLedgerListResponse = - CustomerCreditLedgerListResponse.ofAmendmentLedgerEntry( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.builder() + CustomerCreditLedgerListResponse.ofAmendment( + CustomerCreditLedgerListResponse.Amendment.builder() .id("id") .amount(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditBlock( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.CreditBlock.builder() + CustomerCreditLedgerListResponse.Amendment.CreditBlock.builder() .id("id") .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .perUnitCostBasis("per_unit_cost_basis") @@ -690,19 +651,17 @@ internal class CustomerCreditLedgerListResponseTest { ) .currency("currency") .customer( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.Customer.builder() + CustomerCreditLedgerListResponse.Amendment.Customer.builder() .id("id") .externalCustomerId("external_customer_id") .build() ) .description("description") .endingBalance(0.0) - .entryStatus( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.EntryStatus.COMMITTED - ) + .entryStatus(CustomerCreditLedgerListResponse.Amendment.EntryStatus.COMMITTED) .ledgerSequenceNumber(0L) .metadata( - CustomerCreditLedgerListResponse.AmendmentLedgerEntry.Metadata.builder() + CustomerCreditLedgerListResponse.Amendment.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt index a39f588e6..5d92e224f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt @@ -72,8 +72,7 @@ internal class CustomerUpdateByExternalIdParamsTest { .build() ) .taxConfiguration( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerUpdateByExternalIdParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -161,8 +160,7 @@ internal class CustomerUpdateByExternalIdParamsTest { .build() ) .taxConfiguration( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerUpdateByExternalIdParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -245,9 +243,8 @@ internal class CustomerUpdateByExternalIdParamsTest { ) assertThat(body.taxConfiguration()) .contains( - CustomerUpdateByExternalIdParams.TaxConfiguration.ofNewAvalara( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerUpdateByExternalIdParams.TaxConfiguration.ofAvalara( + CustomerUpdateByExternalIdParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt index 7d6a3c575..e6dbea3f3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt @@ -69,7 +69,7 @@ internal class CustomerUpdateParamsTest { .build() ) .taxConfiguration( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerUpdateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -154,7 +154,7 @@ internal class CustomerUpdateParamsTest { .build() ) .taxConfiguration( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerUpdateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -231,8 +231,8 @@ internal class CustomerUpdateParamsTest { ) assertThat(body.taxConfiguration()) .contains( - CustomerUpdateParams.TaxConfiguration.ofNewAvalara( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerUpdateParams.TaxConfiguration.ofAvalara( + CustomerUpdateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() 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 3c0375cd0..21fb428dc 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 @@ -113,9 +113,7 @@ internal class InvoiceFetchUpcomingResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - InvoiceFetchUpcomingResponse.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + InvoiceFetchUpcomingResponse.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -155,25 +153,24 @@ internal class InvoiceFetchUpcomingResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -191,29 +188,28 @@ internal class InvoiceFetchUpcomingResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -221,14 +217,14 @@ internal class InvoiceFetchUpcomingResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -238,12 +234,10 @@ internal class InvoiceFetchUpcomingResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem.MatrixSubLineItem - .builder() + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem - .MatrixSubLineItem + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -251,8 +245,7 @@ internal class InvoiceFetchUpcomingResponseTest { .build() ) .matrixConfig( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem - .MatrixSubLineItem + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -445,9 +438,7 @@ internal class InvoiceFetchUpcomingResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - InvoiceFetchUpcomingResponse.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + InvoiceFetchUpcomingResponse.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -487,24 +478,22 @@ internal class InvoiceFetchUpcomingResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -522,28 +511,28 @@ internal class InvoiceFetchUpcomingResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -551,14 +540,12 @@ internal class InvoiceFetchUpcomingResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -568,19 +555,17 @@ internal class InvoiceFetchUpcomingResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem.MatrixSubLineItem - .builder() + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem.MatrixSubLineItem + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -776,9 +761,7 @@ internal class InvoiceFetchUpcomingResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - InvoiceFetchUpcomingResponse.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + InvoiceFetchUpcomingResponse.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -818,25 +801,24 @@ internal class InvoiceFetchUpcomingResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -854,29 +836,28 @@ internal class InvoiceFetchUpcomingResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -884,14 +865,14 @@ internal class InvoiceFetchUpcomingResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -901,12 +882,10 @@ internal class InvoiceFetchUpcomingResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem.MatrixSubLineItem - .builder() + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem - .MatrixSubLineItem + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -914,8 +893,7 @@ internal class InvoiceFetchUpcomingResponseTest { .build() ) .matrixConfig( - InvoiceFetchUpcomingResponse.LineItem.SubLineItem - .MatrixSubLineItem + InvoiceFetchUpcomingResponse.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt index 8db2bcf8b..61716a1e3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt @@ -19,8 +19,7 @@ internal class InvoiceLineItemCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + InvoiceLineItemCreateResponse.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -60,22 +59,20 @@ internal class InvoiceLineItemCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -93,28 +90,28 @@ internal class InvoiceLineItemCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -122,12 +119,12 @@ internal class InvoiceLineItemCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -137,18 +134,16 @@ internal class InvoiceLineItemCreateResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.Grouping - .builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) @@ -171,9 +166,8 @@ internal class InvoiceLineItemCreateResponseTest { assertThat(invoiceLineItemCreateResponse.adjustedSubtotal()).isEqualTo("5.00") assertThat(invoiceLineItemCreateResponse.adjustments()) .containsExactly( - InvoiceLineItemCreateResponse.Adjustment.ofMonetaryUsageDiscount( - InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + InvoiceLineItemCreateResponse.Adjustment.ofUsageDiscount( + InvoiceLineItemCreateResponse.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -222,22 +216,20 @@ internal class InvoiceLineItemCreateResponseTest { assertThat(invoiceLineItemCreateResponse.price()) .contains( Price.ofUnit( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -255,28 +247,28 @@ internal class InvoiceLineItemCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -284,12 +276,12 @@ internal class InvoiceLineItemCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -303,18 +295,16 @@ internal class InvoiceLineItemCreateResponseTest { assertThat(invoiceLineItemCreateResponse.subLineItems()) .containsExactly( InvoiceLineItemCreateResponse.SubLineItem.ofMatrix( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.Grouping - .builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) @@ -344,8 +334,7 @@ internal class InvoiceLineItemCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - InvoiceLineItemCreateResponse.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + InvoiceLineItemCreateResponse.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -385,22 +374,20 @@ internal class InvoiceLineItemCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -418,28 +405,28 @@ internal class InvoiceLineItemCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -447,12 +434,12 @@ internal class InvoiceLineItemCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -462,18 +449,16 @@ internal class InvoiceLineItemCreateResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.Grouping - .builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - InvoiceLineItemCreateResponse.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + InvoiceLineItemCreateResponse.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt index f1d257ccc..d16f28d8c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt @@ -115,8 +115,7 @@ internal class InvoiceListPageResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -156,28 +155,26 @@ internal class InvoiceListPageResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -197,30 +194,27 @@ internal class InvoiceListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -228,7 +222,7 @@ internal class InvoiceListPageResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -236,14 +230,14 @@ internal class InvoiceListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -255,18 +249,16 @@ internal class InvoiceListPageResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Grouping - .builder() + Invoice.LineItem.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -441,8 +433,7 @@ internal class InvoiceListPageResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -482,26 +473,25 @@ internal class InvoiceListPageResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -521,32 +511,29 @@ internal class InvoiceListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -554,14 +541,14 @@ internal class InvoiceListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -571,18 +558,16 @@ internal class InvoiceListPageResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Grouping - .builder() + Invoice.LineItem.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) @@ -763,8 +748,7 @@ internal class InvoiceListPageResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -804,28 +788,26 @@ internal class InvoiceListPageResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -845,30 +827,27 @@ internal class InvoiceListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -876,7 +855,7 @@ internal class InvoiceListPageResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -884,14 +863,14 @@ internal class InvoiceListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -903,18 +882,16 @@ internal class InvoiceListPageResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Grouping - .builder() + Invoice.LineItem.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() 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 d14f9a247..b63e5c5aa 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 @@ -105,7 +105,7 @@ internal class InvoiceTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment.builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -145,25 +145,24 @@ internal class InvoiceTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -181,29 +180,28 @@ internal class InvoiceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -211,14 +209,14 @@ internal class InvoiceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -228,18 +226,16 @@ internal class InvoiceTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Grouping - .builder() + Invoice.LineItem.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) @@ -415,7 +411,7 @@ internal class InvoiceTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment.builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -455,24 +451,22 @@ internal class InvoiceTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -490,28 +484,28 @@ internal class InvoiceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -519,14 +513,12 @@ internal class InvoiceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -536,17 +528,16 @@ internal class InvoiceTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Grouping.builder() + Invoice.LineItem.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) @@ -723,7 +714,7 @@ internal class InvoiceTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment.builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -763,25 +754,24 @@ internal class InvoiceTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -799,29 +789,28 @@ internal class InvoiceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -829,14 +818,14 @@ internal class InvoiceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -846,18 +835,16 @@ internal class InvoiceTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.Grouping - .builder() + Invoice.LineItem.SubLineItem.Matrix.Grouping.builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.MatrixConfig - .builder() + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig.builder() .addDimensionValue("string") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt index cdc2093d2..59fb40f18 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt @@ -14,23 +14,22 @@ internal class PlanCreateParamsTest { .currency("currency") .name("name") .addPrice( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration.builder() + PlanCreateParams.Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration - .DurationUnit + PlanCreateParams.Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() @@ -41,18 +40,16 @@ internal class PlanCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration - .DurationUnit + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + PlanCreateParams.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -77,24 +74,22 @@ internal class PlanCreateParamsTest { .currency("currency") .name("name") .addPrice( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .BillingCycleConfiguration + PlanCreateParams.Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -106,19 +101,17 @@ internal class PlanCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .InvoicingCycleConfiguration + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + PlanCreateParams.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -141,25 +134,23 @@ internal class PlanCreateParamsTest { assertThat(body.name()).isEqualTo("name") assertThat(body.prices()) .containsExactly( - PlanCreateParams.Price.ofNewPlanUnit( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.ofUnit( + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .BillingCycleConfiguration + PlanCreateParams.Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -171,19 +162,17 @@ internal class PlanCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .InvoicingCycleConfiguration + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + PlanCreateParams.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -209,12 +198,12 @@ internal class PlanCreateParamsTest { .currency("currency") .name("name") .addPrice( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) @@ -228,13 +217,13 @@ internal class PlanCreateParamsTest { assertThat(body.name()).isEqualTo("name") assertThat(body.prices()) .containsExactly( - PlanCreateParams.Price.ofNewPlanUnit( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.ofUnit( + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt index 4a303159a..eeff4d3db 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt @@ -19,7 +19,7 @@ internal class PlanListPageResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -106,25 +106,24 @@ internal class PlanListPageResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -142,29 +141,28 @@ internal class PlanListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -172,14 +170,14 @@ internal class PlanListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -213,7 +211,7 @@ internal class PlanListPageResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -300,24 +298,22 @@ internal class PlanListPageResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -335,28 +331,28 @@ internal class PlanListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -364,14 +360,12 @@ internal class PlanListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -408,7 +402,7 @@ internal class PlanListPageResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -495,25 +489,24 @@ internal class PlanListPageResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -531,29 +524,28 @@ internal class PlanListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -561,14 +553,14 @@ internal class PlanListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt index b5393d513..af5d68f79 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt @@ -18,7 +18,7 @@ internal class PlanTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -105,22 +105,20 @@ internal class PlanTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -138,28 +136,28 @@ internal class PlanTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -167,12 +165,12 @@ internal class PlanTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -199,8 +197,8 @@ internal class PlanTest { assertThat(plan.id()).isEqualTo("id") assertThat(plan.adjustments()) .containsExactly( - Plan.Adjustment.ofPlanPhaseUsageDiscount( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.ofUsageDiscount( + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -298,22 +296,20 @@ internal class PlanTest { assertThat(plan.prices()) .containsExactly( Price.ofUnit( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -331,28 +327,28 @@ internal class PlanTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -360,12 +356,12 @@ internal class PlanTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -399,7 +395,7 @@ internal class PlanTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -486,22 +482,20 @@ internal class PlanTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -519,28 +513,28 @@ internal class PlanTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -548,12 +542,12 @@ internal class PlanTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt index abfb46074..a450e816b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt @@ -12,26 +12,23 @@ internal class PriceCreateParamsTest { fun create() { PriceCreateParams.builder() .body( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice.BillingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration - .DurationUnit + PriceCreateParams.Body.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() @@ -41,19 +38,16 @@ internal class PriceCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice.InvoicingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration - .DurationUnit + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) .metadata( - PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -67,25 +61,23 @@ internal class PriceCreateParamsTest { val params = PriceCreateParams.builder() .body( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice.BillingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration + PriceCreateParams.Body.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -96,19 +88,17 @@ internal class PriceCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice.InvoicingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -120,26 +110,24 @@ internal class PriceCreateParamsTest { assertThat(body) .isEqualTo( - PriceCreateParams.Body.ofNewFloatingUnitPrice( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.ofUnit( + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice.BillingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration + PriceCreateParams.Body.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -150,19 +138,17 @@ internal class PriceCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice.InvoicingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -176,13 +162,13 @@ internal class PriceCreateParamsTest { val params = PriceCreateParams.builder() .body( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) @@ -194,14 +180,14 @@ internal class PriceCreateParamsTest { assertThat(body) .isEqualTo( - PriceCreateParams.Body.ofNewFloatingUnitPrice( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.ofUnit( + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt index 30c2d5f26..53776c4a4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt @@ -16,22 +16,20 @@ internal class PriceListPageResponseTest { val priceListPageResponse = PriceListPageResponse.builder() .addData( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -49,28 +47,28 @@ internal class PriceListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -78,12 +76,12 @@ internal class PriceListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -98,22 +96,20 @@ internal class PriceListPageResponseTest { assertThat(priceListPageResponse.data()) .containsExactly( Price.ofUnit( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -131,28 +127,28 @@ internal class PriceListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -160,12 +156,12 @@ internal class PriceListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -183,22 +179,20 @@ internal class PriceListPageResponseTest { val priceListPageResponse = PriceListPageResponse.builder() .addData( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -216,28 +210,28 @@ internal class PriceListPageResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -245,12 +239,12 @@ internal class PriceListPageResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt index 6647ea493..730357deb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt @@ -18,20 +18,20 @@ internal class PriceTest { @Test fun ofUnit() { val unit = - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -49,26 +49,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -76,10 +76,10 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) - .unitConfig(Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build()) + .priceType(Price.Unit.PriceType.USAGE_PRICE) + .unitConfig(Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -89,7 +89,7 @@ internal class PriceTest { val price = Price.ofUnit(unit) assertThat(price.unit()).contains(unit) - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -123,22 +123,20 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofUnit( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric(Price.UnitPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -156,28 +154,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -185,12 +181,10 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) - .unitConfig( - Price.UnitPrice.UnitConfig.builder().unitAmount("unit_amount").build() - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) + .unitConfig(Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -205,22 +199,22 @@ internal class PriceTest { } @Test - fun ofPackagePrice() { - val packagePrice = - Price.PackagePrice.builder() + fun ofPackage() { + val package_ = + Price.Package.builder() .id("id") - .billableMetric(Price.PackagePrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Package.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.PackagePrice.BillingCycleConfiguration.builder() + Price.Package.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.PackagePrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Package.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.PackagePrice.Cadence.ONE_TIME) + .cadence(Price.Package.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.PackagePrice.CreditAllocation.builder() + Price.Package.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -238,28 +232,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.PackagePrice.InvoicingCycleConfiguration.builder() + Price.Package.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.PackagePrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Package.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.PackagePrice.Item.builder().id("id").name("name").build()) + .item(Price.Package.Item.builder().id("id").name("name").build()) .maximum( - Price.PackagePrice.Maximum.builder() + Price.Package.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.PackagePrice.Metadata.builder() + Price.Package.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.PackagePrice.Minimum.builder() + Price.Package.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -267,25 +259,25 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .packageConfig( - Price.PackagePrice.PackageConfig.builder() + Price.Package.PackageConfig.builder() .packageAmount("package_amount") .packageSize(0L) .build() ) .planPhaseOrder(0L) - .priceType(Price.PackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.Package.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.PackagePrice.DimensionalPriceConfiguration.builder() + Price.Package.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() ) .build() - val price = Price.ofPackagePrice(packagePrice) + val price = Price.ofPackage(package_) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).contains(packagePrice) + assertThat(price.package_()).contains(package_) assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -315,26 +307,24 @@ internal class PriceTest { } @Test - fun ofPackagePriceRoundtrip() { + fun ofPackageRoundtrip() { val jsonMapper = jsonMapper() val price = - Price.ofPackagePrice( - Price.PackagePrice.builder() + Price.ofPackage( + Price.Package.builder() .id("id") - .billableMetric(Price.PackagePrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Package.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.PackagePrice.BillingCycleConfiguration.builder() + Price.Package.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.PackagePrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Package.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.PackagePrice.Cadence.ONE_TIME) + .cadence(Price.Package.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.PackagePrice.CreditAllocation.builder() + Price.Package.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -352,28 +342,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.PackagePrice.InvoicingCycleConfiguration.builder() + Price.Package.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.PackagePrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Package.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.PackagePrice.Item.builder().id("id").name("name").build()) + .item(Price.Package.Item.builder().id("id").name("name").build()) .maximum( - Price.PackagePrice.Maximum.builder() + Price.Package.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.PackagePrice.Metadata.builder() + Price.Package.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.PackagePrice.Minimum.builder() + Price.Package.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -381,15 +371,15 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .packageConfig( - Price.PackagePrice.PackageConfig.builder() + Price.Package.PackageConfig.builder() .packageAmount("package_amount") .packageSize(0L) .build() ) .planPhaseOrder(0L) - .priceType(Price.PackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.Package.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.PackagePrice.DimensionalPriceConfiguration.builder() + Price.Package.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -406,20 +396,20 @@ internal class PriceTest { @Test fun ofMatrix() { val matrix = - Price.MatrixPrice.builder() + Price.Matrix.builder() .id("id") - .billableMetric(Price.MatrixPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Matrix.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.MatrixPrice.BillingCycleConfiguration.builder() + Price.Matrix.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.MatrixPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Matrix.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.MatrixPrice.Cadence.ONE_TIME) + .cadence(Price.Matrix.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MatrixPrice.CreditAllocation.builder() + Price.Matrix.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -437,20 +427,18 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MatrixPrice.InvoicingCycleConfiguration.builder() + Price.Matrix.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.MatrixPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Matrix.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.MatrixPrice.Item.builder().id("id").name("name").build()) + .item(Price.Matrix.Item.builder().id("id").name("name").build()) .matrixConfig( - Price.MatrixPrice.MatrixConfig.builder() + Price.Matrix.MatrixConfig.builder() .defaultUnitAmount("default_unit_amount") .addDimension("string") .addMatrixValue( - Price.MatrixPrice.MatrixConfig.MatrixValue.builder() + Price.Matrix.MatrixConfig.MatrixValue.builder() .addDimensionValue("string") .unitAmount("unit_amount") .build() @@ -458,19 +446,19 @@ internal class PriceTest { .build() ) .maximum( - Price.MatrixPrice.Maximum.builder() + Price.Matrix.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MatrixPrice.Metadata.builder() + Price.Matrix.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MatrixPrice.Minimum.builder() + Price.Matrix.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -478,9 +466,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MatrixPrice.PriceType.USAGE_PRICE) + .priceType(Price.Matrix.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MatrixPrice.DimensionalPriceConfiguration.builder() + Price.Matrix.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -490,7 +478,7 @@ internal class PriceTest { val price = Price.ofMatrix(matrix) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).contains(matrix) assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -524,22 +512,20 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofMatrix( - Price.MatrixPrice.builder() + Price.Matrix.builder() .id("id") - .billableMetric(Price.MatrixPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Matrix.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.MatrixPrice.BillingCycleConfiguration.builder() + Price.Matrix.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.MatrixPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Matrix.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.MatrixPrice.Cadence.ONE_TIME) + .cadence(Price.Matrix.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MatrixPrice.CreditAllocation.builder() + Price.Matrix.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -557,20 +543,18 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MatrixPrice.InvoicingCycleConfiguration.builder() + Price.Matrix.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.MatrixPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Matrix.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.MatrixPrice.Item.builder().id("id").name("name").build()) + .item(Price.Matrix.Item.builder().id("id").name("name").build()) .matrixConfig( - Price.MatrixPrice.MatrixConfig.builder() + Price.Matrix.MatrixConfig.builder() .defaultUnitAmount("default_unit_amount") .addDimension("string") .addMatrixValue( - Price.MatrixPrice.MatrixConfig.MatrixValue.builder() + Price.Matrix.MatrixConfig.MatrixValue.builder() .addDimensionValue("string") .unitAmount("unit_amount") .build() @@ -578,19 +562,19 @@ internal class PriceTest { .build() ) .maximum( - Price.MatrixPrice.Maximum.builder() + Price.Matrix.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MatrixPrice.Metadata.builder() + Price.Matrix.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MatrixPrice.Minimum.builder() + Price.Matrix.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -598,9 +582,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MatrixPrice.PriceType.USAGE_PRICE) + .priceType(Price.Matrix.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MatrixPrice.DimensionalPriceConfiguration.builder() + Price.Matrix.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -617,20 +601,20 @@ internal class PriceTest { @Test fun ofTiered() { val tiered = - Price.TieredPrice.builder() + Price.Tiered.builder() .id("id") - .billableMetric(Price.TieredPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Tiered.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredPrice.BillingCycleConfiguration.builder() + Price.Tiered.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.TieredPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Tiered.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.TieredPrice.Cadence.ONE_TIME) + .cadence(Price.Tiered.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredPrice.CreditAllocation.builder() + Price.Tiered.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -648,28 +632,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredPrice.InvoicingCycleConfiguration.builder() + Price.Tiered.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.TieredPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Tiered.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.TieredPrice.Item.builder().id("id").name("name").build()) + .item(Price.Tiered.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredPrice.Maximum.builder() + Price.Tiered.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredPrice.Metadata.builder() + Price.Tiered.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredPrice.Minimum.builder() + Price.Tiered.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -677,11 +659,11 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredPrice.PriceType.USAGE_PRICE) + .priceType(Price.Tiered.PriceType.USAGE_PRICE) .tieredConfig( - Price.TieredPrice.TieredConfig.builder() + Price.Tiered.TieredConfig.builder() .addTier( - Price.TieredPrice.TieredConfig.Tier.builder() + Price.Tiered.TieredConfig.Tier.builder() .firstUnit(0.0) .unitAmount("unit_amount") .lastUnit(0.0) @@ -690,7 +672,7 @@ internal class PriceTest { .build() ) .dimensionalPriceConfiguration( - Price.TieredPrice.DimensionalPriceConfiguration.builder() + Price.Tiered.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -700,7 +682,7 @@ internal class PriceTest { val price = Price.ofTiered(tiered) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).contains(tiered) assertThat(price.tieredBps()).isEmpty @@ -734,22 +716,20 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofTiered( - Price.TieredPrice.builder() + Price.Tiered.builder() .id("id") - .billableMetric(Price.TieredPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Tiered.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredPrice.BillingCycleConfiguration.builder() + Price.Tiered.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.TieredPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Tiered.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.TieredPrice.Cadence.ONE_TIME) + .cadence(Price.Tiered.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredPrice.CreditAllocation.builder() + Price.Tiered.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -767,28 +747,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredPrice.InvoicingCycleConfiguration.builder() + Price.Tiered.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.TieredPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Tiered.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.TieredPrice.Item.builder().id("id").name("name").build()) + .item(Price.Tiered.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredPrice.Maximum.builder() + Price.Tiered.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredPrice.Metadata.builder() + Price.Tiered.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredPrice.Minimum.builder() + Price.Tiered.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -796,11 +774,11 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredPrice.PriceType.USAGE_PRICE) + .priceType(Price.Tiered.PriceType.USAGE_PRICE) .tieredConfig( - Price.TieredPrice.TieredConfig.builder() + Price.Tiered.TieredConfig.builder() .addTier( - Price.TieredPrice.TieredConfig.Tier.builder() + Price.Tiered.TieredConfig.Tier.builder() .firstUnit(0.0) .unitAmount("unit_amount") .lastUnit(0.0) @@ -809,7 +787,7 @@ internal class PriceTest { .build() ) .dimensionalPriceConfiguration( - Price.TieredPrice.DimensionalPriceConfiguration.builder() + Price.Tiered.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -826,22 +804,20 @@ internal class PriceTest { @Test fun ofTieredBps() { val tieredBps = - Price.TieredBpsPrice.builder() + Price.TieredBps.builder() .id("id") - .billableMetric(Price.TieredBpsPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.TieredBps.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredBpsPrice.BillingCycleConfiguration.builder() + Price.TieredBps.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.TieredBpsPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.TieredBps.BillingCycleConfiguration.DurationUnit.DAY) .build() ) - .cadence(Price.TieredBpsPrice.Cadence.ONE_TIME) + .cadence(Price.TieredBps.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredBpsPrice.CreditAllocation.builder() + Price.TieredBps.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -859,28 +835,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredBpsPrice.InvoicingCycleConfiguration.builder() + Price.TieredBps.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.TieredBpsPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.TieredBps.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.TieredBpsPrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredBps.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredBpsPrice.Maximum.builder() + Price.TieredBps.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredBpsPrice.Metadata.builder() + Price.TieredBps.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredBpsPrice.Minimum.builder() + Price.TieredBps.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -888,11 +862,11 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredBpsPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredBps.PriceType.USAGE_PRICE) .tieredBpsConfig( - Price.TieredBpsPrice.TieredBpsConfig.builder() + Price.TieredBps.TieredBpsConfig.builder() .addTier( - Price.TieredBpsPrice.TieredBpsConfig.Tier.builder() + Price.TieredBps.TieredBpsConfig.Tier.builder() .bps(0.0) .minimumAmount("minimum_amount") .maximumAmount("maximum_amount") @@ -902,7 +876,7 @@ internal class PriceTest { .build() ) .dimensionalPriceConfiguration( - Price.TieredBpsPrice.DimensionalPriceConfiguration.builder() + Price.TieredBps.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -912,7 +886,7 @@ internal class PriceTest { val price = Price.ofTieredBps(tieredBps) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).contains(tieredBps) @@ -946,22 +920,22 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofTieredBps( - Price.TieredBpsPrice.builder() + Price.TieredBps.builder() .id("id") - .billableMetric(Price.TieredBpsPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.TieredBps.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredBpsPrice.BillingCycleConfiguration.builder() + Price.TieredBps.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredBpsPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.TieredBps.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredBpsPrice.Cadence.ONE_TIME) + .cadence(Price.TieredBps.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredBpsPrice.CreditAllocation.builder() + Price.TieredBps.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -979,28 +953,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredBpsPrice.InvoicingCycleConfiguration.builder() + Price.TieredBps.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredBpsPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.TieredBps.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.TieredBpsPrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredBps.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredBpsPrice.Maximum.builder() + Price.TieredBps.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredBpsPrice.Metadata.builder() + Price.TieredBps.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredBpsPrice.Minimum.builder() + Price.TieredBps.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1008,11 +982,11 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredBpsPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredBps.PriceType.USAGE_PRICE) .tieredBpsConfig( - Price.TieredBpsPrice.TieredBpsConfig.builder() + Price.TieredBps.TieredBpsConfig.builder() .addTier( - Price.TieredBpsPrice.TieredBpsConfig.Tier.builder() + Price.TieredBps.TieredBpsConfig.Tier.builder() .bps(0.0) .minimumAmount("minimum_amount") .maximumAmount("maximum_amount") @@ -1022,7 +996,7 @@ internal class PriceTest { .build() ) .dimensionalPriceConfiguration( - Price.TieredBpsPrice.DimensionalPriceConfiguration.builder() + Price.TieredBps.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1039,26 +1013,26 @@ internal class PriceTest { @Test fun ofBps() { val bps = - Price.BpsPrice.builder() + Price.Bps.builder() .id("id") - .billableMetric(Price.BpsPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Bps.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BpsPrice.BillingCycleConfiguration.builder() + Price.Bps.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.BpsPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Bps.BillingCycleConfiguration.DurationUnit.DAY) .build() ) .bpsConfig( - Price.BpsPrice.BpsConfig.builder() + Price.Bps.BpsConfig.builder() .bps(0.0) .perUnitMaximum("per_unit_maximum") .build() ) - .cadence(Price.BpsPrice.Cadence.ONE_TIME) + .cadence(Price.Bps.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BpsPrice.CreditAllocation.builder() + Price.Bps.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1076,26 +1050,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BpsPrice.InvoicingCycleConfiguration.builder() + Price.Bps.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.BpsPrice.InvoicingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Bps.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.BpsPrice.Item.builder().id("id").name("name").build()) + .item(Price.Bps.Item.builder().id("id").name("name").build()) .maximum( - Price.BpsPrice.Maximum.builder() + Price.Bps.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BpsPrice.Metadata.builder() + Price.Bps.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BpsPrice.Minimum.builder() + Price.Bps.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1103,9 +1077,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BpsPrice.PriceType.USAGE_PRICE) + .priceType(Price.Bps.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BpsPrice.DimensionalPriceConfiguration.builder() + Price.Bps.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1115,7 +1089,7 @@ internal class PriceTest { val price = Price.ofBps(bps) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -1149,26 +1123,26 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofBps( - Price.BpsPrice.builder() + Price.Bps.builder() .id("id") - .billableMetric(Price.BpsPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Bps.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BpsPrice.BillingCycleConfiguration.builder() + Price.Bps.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.BpsPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Bps.BillingCycleConfiguration.DurationUnit.DAY) .build() ) .bpsConfig( - Price.BpsPrice.BpsConfig.builder() + Price.Bps.BpsConfig.builder() .bps(0.0) .perUnitMaximum("per_unit_maximum") .build() ) - .cadence(Price.BpsPrice.Cadence.ONE_TIME) + .cadence(Price.Bps.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BpsPrice.CreditAllocation.builder() + Price.Bps.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1186,28 +1160,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BpsPrice.InvoicingCycleConfiguration.builder() + Price.Bps.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.BpsPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Bps.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.BpsPrice.Item.builder().id("id").name("name").build()) + .item(Price.Bps.Item.builder().id("id").name("name").build()) .maximum( - Price.BpsPrice.Maximum.builder() + Price.Bps.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BpsPrice.Metadata.builder() + Price.Bps.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BpsPrice.Minimum.builder() + Price.Bps.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1215,9 +1187,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BpsPrice.PriceType.USAGE_PRICE) + .priceType(Price.Bps.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BpsPrice.DimensionalPriceConfiguration.builder() + Price.Bps.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1234,19 +1206,19 @@ internal class PriceTest { @Test fun ofBulkBps() { val bulkBps = - Price.BulkBpsPrice.builder() + Price.BulkBps.builder() .id("id") - .billableMetric(Price.BulkBpsPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.BulkBps.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BulkBpsPrice.BillingCycleConfiguration.builder() + Price.BulkBps.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.BulkBpsPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.BulkBps.BillingCycleConfiguration.DurationUnit.DAY) .build() ) .bulkBpsConfig( - Price.BulkBpsPrice.BulkBpsConfig.builder() + Price.BulkBps.BulkBpsConfig.builder() .addTier( - Price.BulkBpsPrice.BulkBpsConfig.Tier.builder() + Price.BulkBps.BulkBpsConfig.Tier.builder() .bps(0.0) .maximumAmount("maximum_amount") .perUnitMaximum("per_unit_maximum") @@ -1254,11 +1226,11 @@ internal class PriceTest { ) .build() ) - .cadence(Price.BulkBpsPrice.Cadence.ONE_TIME) + .cadence(Price.BulkBps.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BulkBpsPrice.CreditAllocation.builder() + Price.BulkBps.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1276,28 +1248,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BulkBpsPrice.InvoicingCycleConfiguration.builder() + Price.BulkBps.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.BulkBpsPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.BulkBps.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.BulkBpsPrice.Item.builder().id("id").name("name").build()) + .item(Price.BulkBps.Item.builder().id("id").name("name").build()) .maximum( - Price.BulkBpsPrice.Maximum.builder() + Price.BulkBps.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BulkBpsPrice.Metadata.builder() + Price.BulkBps.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BulkBpsPrice.Minimum.builder() + Price.BulkBps.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1305,9 +1275,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BulkBpsPrice.PriceType.USAGE_PRICE) + .priceType(Price.BulkBps.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BulkBpsPrice.DimensionalPriceConfiguration.builder() + Price.BulkBps.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1317,7 +1287,7 @@ internal class PriceTest { val price = Price.ofBulkBps(bulkBps) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -1351,21 +1321,19 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofBulkBps( - Price.BulkBpsPrice.builder() + Price.BulkBps.builder() .id("id") - .billableMetric(Price.BulkBpsPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.BulkBps.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BulkBpsPrice.BillingCycleConfiguration.builder() + Price.BulkBps.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.BulkBpsPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.BulkBps.BillingCycleConfiguration.DurationUnit.DAY) .build() ) .bulkBpsConfig( - Price.BulkBpsPrice.BulkBpsConfig.builder() + Price.BulkBps.BulkBpsConfig.builder() .addTier( - Price.BulkBpsPrice.BulkBpsConfig.Tier.builder() + Price.BulkBps.BulkBpsConfig.Tier.builder() .bps(0.0) .maximumAmount("maximum_amount") .perUnitMaximum("per_unit_maximum") @@ -1373,11 +1341,11 @@ internal class PriceTest { ) .build() ) - .cadence(Price.BulkBpsPrice.Cadence.ONE_TIME) + .cadence(Price.BulkBps.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BulkBpsPrice.CreditAllocation.builder() + Price.BulkBps.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1395,28 +1363,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BulkBpsPrice.InvoicingCycleConfiguration.builder() + Price.BulkBps.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.BulkBpsPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.BulkBps.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.BulkBpsPrice.Item.builder().id("id").name("name").build()) + .item(Price.BulkBps.Item.builder().id("id").name("name").build()) .maximum( - Price.BulkBpsPrice.Maximum.builder() + Price.BulkBps.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BulkBpsPrice.Metadata.builder() + Price.BulkBps.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BulkBpsPrice.Minimum.builder() + Price.BulkBps.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1424,9 +1392,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BulkBpsPrice.PriceType.USAGE_PRICE) + .priceType(Price.BulkBps.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BulkBpsPrice.DimensionalPriceConfiguration.builder() + Price.BulkBps.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1443,30 +1411,30 @@ internal class PriceTest { @Test fun ofBulk() { val bulk = - Price.BulkPrice.builder() + Price.Bulk.builder() .id("id") - .billableMetric(Price.BulkPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Bulk.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BulkPrice.BillingCycleConfiguration.builder() + Price.Bulk.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.BulkPrice.BillingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Bulk.BillingCycleConfiguration.DurationUnit.DAY) .build() ) .bulkConfig( - Price.BulkPrice.BulkConfig.builder() + Price.Bulk.BulkConfig.builder() .addTier( - Price.BulkPrice.BulkConfig.Tier.builder() + Price.Bulk.BulkConfig.Tier.builder() .unitAmount("unit_amount") .maximumUnits(0.0) .build() ) .build() ) - .cadence(Price.BulkPrice.Cadence.ONE_TIME) + .cadence(Price.Bulk.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BulkPrice.CreditAllocation.builder() + Price.Bulk.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1484,26 +1452,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BulkPrice.InvoicingCycleConfiguration.builder() + Price.Bulk.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit(Price.BulkPrice.InvoicingCycleConfiguration.DurationUnit.DAY) + .durationUnit(Price.Bulk.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.BulkPrice.Item.builder().id("id").name("name").build()) + .item(Price.Bulk.Item.builder().id("id").name("name").build()) .maximum( - Price.BulkPrice.Maximum.builder() + Price.Bulk.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BulkPrice.Metadata.builder() + Price.Bulk.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BulkPrice.Minimum.builder() + Price.Bulk.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1511,9 +1479,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BulkPrice.PriceType.USAGE_PRICE) + .priceType(Price.Bulk.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BulkPrice.DimensionalPriceConfiguration.builder() + Price.Bulk.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1523,7 +1491,7 @@ internal class PriceTest { val price = Price.ofBulk(bulk) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -1557,32 +1525,30 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofBulk( - Price.BulkPrice.builder() + Price.Bulk.builder() .id("id") - .billableMetric(Price.BulkPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.Bulk.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BulkPrice.BillingCycleConfiguration.builder() + Price.Bulk.BillingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.BulkPrice.BillingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Bulk.BillingCycleConfiguration.DurationUnit.DAY) .build() ) .bulkConfig( - Price.BulkPrice.BulkConfig.builder() + Price.Bulk.BulkConfig.builder() .addTier( - Price.BulkPrice.BulkConfig.Tier.builder() + Price.Bulk.BulkConfig.Tier.builder() .unitAmount("unit_amount") .maximumUnits(0.0) .build() ) .build() ) - .cadence(Price.BulkPrice.Cadence.ONE_TIME) + .cadence(Price.Bulk.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BulkPrice.CreditAllocation.builder() + Price.Bulk.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1600,28 +1566,26 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BulkPrice.InvoicingCycleConfiguration.builder() + Price.Bulk.InvoicingCycleConfiguration.builder() .duration(0L) - .durationUnit( - Price.BulkPrice.InvoicingCycleConfiguration.DurationUnit.DAY - ) + .durationUnit(Price.Bulk.InvoicingCycleConfiguration.DurationUnit.DAY) .build() ) - .item(Price.BulkPrice.Item.builder().id("id").name("name").build()) + .item(Price.Bulk.Item.builder().id("id").name("name").build()) .maximum( - Price.BulkPrice.Maximum.builder() + Price.Bulk.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BulkPrice.Metadata.builder() + Price.Bulk.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BulkPrice.Minimum.builder() + Price.Bulk.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1629,9 +1593,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BulkPrice.PriceType.USAGE_PRICE) + .priceType(Price.Bulk.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BulkPrice.DimensionalPriceConfiguration.builder() + Price.Bulk.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1648,25 +1612,24 @@ internal class PriceTest { @Test fun ofThresholdTotalAmount() { val thresholdTotalAmount = - Price.ThresholdTotalAmountPrice.builder() + Price.ThresholdTotalAmount.builder() .id("id") .billableMetric( - Price.ThresholdTotalAmountPrice.BillableMetric.builder().id("id").build() + Price.ThresholdTotalAmount.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.ThresholdTotalAmountPrice.BillingCycleConfiguration.builder() + Price.ThresholdTotalAmount.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ThresholdTotalAmountPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.ThresholdTotalAmount.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.ThresholdTotalAmountPrice.Cadence.ONE_TIME) + .cadence(Price.ThresholdTotalAmount.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.ThresholdTotalAmountPrice.CreditAllocation.builder() + Price.ThresholdTotalAmount.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1684,29 +1647,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.ThresholdTotalAmountPrice.InvoicingCycleConfiguration.builder() + Price.ThresholdTotalAmount.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ThresholdTotalAmountPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.ThresholdTotalAmount.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.ThresholdTotalAmountPrice.Item.builder().id("id").name("name").build()) + .item(Price.ThresholdTotalAmount.Item.builder().id("id").name("name").build()) .maximum( - Price.ThresholdTotalAmountPrice.Maximum.builder() + Price.ThresholdTotalAmount.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.ThresholdTotalAmountPrice.Metadata.builder() + Price.ThresholdTotalAmount.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.ThresholdTotalAmountPrice.Minimum.builder() + Price.ThresholdTotalAmount.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1714,14 +1676,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.ThresholdTotalAmountPrice.PriceType.USAGE_PRICE) + .priceType(Price.ThresholdTotalAmount.PriceType.USAGE_PRICE) .thresholdTotalAmountConfig( - Price.ThresholdTotalAmountPrice.ThresholdTotalAmountConfig.builder() + Price.ThresholdTotalAmount.ThresholdTotalAmountConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.ThresholdTotalAmountPrice.DimensionalPriceConfiguration.builder() + Price.ThresholdTotalAmount.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1731,7 +1693,7 @@ internal class PriceTest { val price = Price.ofThresholdTotalAmount(thresholdTotalAmount) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -1765,26 +1727,25 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofThresholdTotalAmount( - Price.ThresholdTotalAmountPrice.builder() + Price.ThresholdTotalAmount.builder() .id("id") .billableMetric( - Price.ThresholdTotalAmountPrice.BillableMetric.builder().id("id").build() + Price.ThresholdTotalAmount.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.ThresholdTotalAmountPrice.BillingCycleConfiguration.builder() + Price.ThresholdTotalAmount.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ThresholdTotalAmountPrice.BillingCycleConfiguration - .DurationUnit + Price.ThresholdTotalAmount.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.ThresholdTotalAmountPrice.Cadence.ONE_TIME) + .cadence(Price.ThresholdTotalAmount.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.ThresholdTotalAmountPrice.CreditAllocation.builder() + Price.ThresholdTotalAmount.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1802,32 +1763,29 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.ThresholdTotalAmountPrice.InvoicingCycleConfiguration.builder() + Price.ThresholdTotalAmount.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ThresholdTotalAmountPrice.InvoicingCycleConfiguration - .DurationUnit + Price.ThresholdTotalAmount.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.ThresholdTotalAmountPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.ThresholdTotalAmount.Item.builder().id("id").name("name").build()) .maximum( - Price.ThresholdTotalAmountPrice.Maximum.builder() + Price.ThresholdTotalAmount.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.ThresholdTotalAmountPrice.Metadata.builder() + Price.ThresholdTotalAmount.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.ThresholdTotalAmountPrice.Minimum.builder() + Price.ThresholdTotalAmount.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1835,14 +1793,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.ThresholdTotalAmountPrice.PriceType.USAGE_PRICE) + .priceType(Price.ThresholdTotalAmount.PriceType.USAGE_PRICE) .thresholdTotalAmountConfig( - Price.ThresholdTotalAmountPrice.ThresholdTotalAmountConfig.builder() + Price.ThresholdTotalAmount.ThresholdTotalAmountConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.ThresholdTotalAmountPrice.DimensionalPriceConfiguration.builder() + Price.ThresholdTotalAmount.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1859,22 +1817,22 @@ internal class PriceTest { @Test fun ofTieredPackage() { val tieredPackage = - Price.TieredPackagePrice.builder() + Price.TieredPackage.builder() .id("id") - .billableMetric(Price.TieredPackagePrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.TieredPackage.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredPackagePrice.BillingCycleConfiguration.builder() + Price.TieredPackage.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackagePrice.BillingCycleConfiguration.DurationUnit.DAY + Price.TieredPackage.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredPackagePrice.Cadence.ONE_TIME) + .cadence(Price.TieredPackage.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredPackagePrice.CreditAllocation.builder() + Price.TieredPackage.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1892,28 +1850,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredPackagePrice.InvoicingCycleConfiguration.builder() + Price.TieredPackage.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackagePrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.TieredPackage.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.TieredPackagePrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredPackage.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredPackagePrice.Maximum.builder() + Price.TieredPackage.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredPackagePrice.Metadata.builder() + Price.TieredPackage.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredPackagePrice.Minimum.builder() + Price.TieredPackage.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1921,14 +1879,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredPackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredPackage.PriceType.USAGE_PRICE) .tieredPackageConfig( - Price.TieredPackagePrice.TieredPackageConfig.builder() + Price.TieredPackage.TieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredPackagePrice.DimensionalPriceConfiguration.builder() + Price.TieredPackage.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1938,7 +1896,7 @@ internal class PriceTest { val price = Price.ofTieredPackage(tieredPackage) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -1972,24 +1930,22 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofTieredPackage( - Price.TieredPackagePrice.builder() + Price.TieredPackage.builder() .id("id") - .billableMetric( - Price.TieredPackagePrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.TieredPackage.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredPackagePrice.BillingCycleConfiguration.builder() + Price.TieredPackage.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackagePrice.BillingCycleConfiguration.DurationUnit.DAY + Price.TieredPackage.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredPackagePrice.Cadence.ONE_TIME) + .cadence(Price.TieredPackage.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredPackagePrice.CreditAllocation.builder() + Price.TieredPackage.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2007,29 +1963,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredPackagePrice.InvoicingCycleConfiguration.builder() + Price.TieredPackage.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackagePrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.TieredPackage.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.TieredPackagePrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredPackage.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredPackagePrice.Maximum.builder() + Price.TieredPackage.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredPackagePrice.Metadata.builder() + Price.TieredPackage.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredPackagePrice.Minimum.builder() + Price.TieredPackage.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2037,14 +1992,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredPackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredPackage.PriceType.USAGE_PRICE) .tieredPackageConfig( - Price.TieredPackagePrice.TieredPackageConfig.builder() + Price.TieredPackage.TieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredPackagePrice.DimensionalPriceConfiguration.builder() + Price.TieredPackage.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2061,22 +2016,22 @@ internal class PriceTest { @Test fun ofGroupedTiered() { val groupedTiered = - Price.GroupedTieredPrice.builder() + Price.GroupedTiered.builder() .id("id") - .billableMetric(Price.GroupedTieredPrice.BillableMetric.builder().id("id").build()) + .billableMetric(Price.GroupedTiered.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.GroupedTieredPrice.BillingCycleConfiguration.builder() + Price.GroupedTiered.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.GroupedTiered.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.GroupedTieredPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedTiered.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedTieredPrice.CreditAllocation.builder() + Price.GroupedTiered.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2094,33 +2049,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedTieredConfig( - Price.GroupedTieredPrice.GroupedTieredConfig.builder() + Price.GroupedTiered.GroupedTieredConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedTieredPrice.InvoicingCycleConfiguration.builder() + Price.GroupedTiered.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.GroupedTiered.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.GroupedTieredPrice.Item.builder().id("id").name("name").build()) + .item(Price.GroupedTiered.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedTieredPrice.Maximum.builder() + Price.GroupedTiered.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedTieredPrice.Metadata.builder() + Price.GroupedTiered.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedTieredPrice.Minimum.builder() + Price.GroupedTiered.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2128,9 +2083,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedTieredPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedTiered.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedTieredPrice.DimensionalPriceConfiguration.builder() + Price.GroupedTiered.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2140,7 +2095,7 @@ internal class PriceTest { val price = Price.ofGroupedTiered(groupedTiered) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -2174,24 +2129,22 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofGroupedTiered( - Price.GroupedTieredPrice.builder() + Price.GroupedTiered.builder() .id("id") - .billableMetric( - Price.GroupedTieredPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.GroupedTiered.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.GroupedTieredPrice.BillingCycleConfiguration.builder() + Price.GroupedTiered.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.GroupedTiered.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.GroupedTieredPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedTiered.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedTieredPrice.CreditAllocation.builder() + Price.GroupedTiered.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2209,34 +2162,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedTieredConfig( - Price.GroupedTieredPrice.GroupedTieredConfig.builder() + Price.GroupedTiered.GroupedTieredConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedTieredPrice.InvoicingCycleConfiguration.builder() + Price.GroupedTiered.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.GroupedTiered.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.GroupedTieredPrice.Item.builder().id("id").name("name").build()) + .item(Price.GroupedTiered.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedTieredPrice.Maximum.builder() + Price.GroupedTiered.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedTieredPrice.Metadata.builder() + Price.GroupedTiered.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedTieredPrice.Minimum.builder() + Price.GroupedTiered.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2244,9 +2196,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedTieredPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedTiered.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedTieredPrice.DimensionalPriceConfiguration.builder() + Price.GroupedTiered.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2263,24 +2215,22 @@ internal class PriceTest { @Test fun ofTieredWithMinimum() { val tieredWithMinimum = - Price.TieredWithMinimumPrice.builder() + Price.TieredWithMinimum.builder() .id("id") - .billableMetric( - Price.TieredWithMinimumPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.TieredWithMinimum.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredWithMinimumPrice.BillingCycleConfiguration.builder() + Price.TieredWithMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithMinimumPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.TieredWithMinimum.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredWithMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.TieredWithMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredWithMinimumPrice.CreditAllocation.builder() + Price.TieredWithMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2298,29 +2248,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredWithMinimumPrice.InvoicingCycleConfiguration.builder() + Price.TieredWithMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithMinimumPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.TieredWithMinimum.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.TieredWithMinimumPrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredWithMinimum.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredWithMinimumPrice.Maximum.builder() + Price.TieredWithMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredWithMinimumPrice.Metadata.builder() + Price.TieredWithMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredWithMinimumPrice.Minimum.builder() + Price.TieredWithMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2328,14 +2277,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredWithMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredWithMinimum.PriceType.USAGE_PRICE) .tieredWithMinimumConfig( - Price.TieredWithMinimumPrice.TieredWithMinimumConfig.builder() + Price.TieredWithMinimum.TieredWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredWithMinimumPrice.DimensionalPriceConfiguration.builder() + Price.TieredWithMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2345,7 +2294,7 @@ internal class PriceTest { val price = Price.ofTieredWithMinimum(tieredWithMinimum) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -2379,25 +2328,24 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofTieredWithMinimum( - Price.TieredWithMinimumPrice.builder() + Price.TieredWithMinimum.builder() .id("id") .billableMetric( - Price.TieredWithMinimumPrice.BillableMetric.builder().id("id").build() + Price.TieredWithMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.TieredWithMinimumPrice.BillingCycleConfiguration.builder() + Price.TieredWithMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithMinimumPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.TieredWithMinimum.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredWithMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.TieredWithMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredWithMinimumPrice.CreditAllocation.builder() + Price.TieredWithMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2415,30 +2363,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredWithMinimumPrice.InvoicingCycleConfiguration.builder() + Price.TieredWithMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithMinimumPrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.TieredWithMinimum.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.TieredWithMinimumPrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredWithMinimum.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredWithMinimumPrice.Maximum.builder() + Price.TieredWithMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredWithMinimumPrice.Metadata.builder() + Price.TieredWithMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredWithMinimumPrice.Minimum.builder() + Price.TieredWithMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2446,14 +2392,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredWithMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredWithMinimum.PriceType.USAGE_PRICE) .tieredWithMinimumConfig( - Price.TieredWithMinimumPrice.TieredWithMinimumConfig.builder() + Price.TieredWithMinimum.TieredWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredWithMinimumPrice.DimensionalPriceConfiguration.builder() + Price.TieredWithMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2470,26 +2416,25 @@ internal class PriceTest { @Test fun ofTieredPackageWithMinimum() { val tieredPackageWithMinimum = - Price.TieredPackageWithMinimumPrice.builder() + Price.TieredPackageWithMinimum.builder() .id("id") .billableMetric( - Price.TieredPackageWithMinimumPrice.BillableMetric.builder().id("id").build() + Price.TieredPackageWithMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.TieredPackageWithMinimumPrice.BillingCycleConfiguration.builder() + Price.TieredPackageWithMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackageWithMinimumPrice.BillingCycleConfiguration - .DurationUnit + Price.TieredPackageWithMinimum.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.TieredPackageWithMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.TieredPackageWithMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredPackageWithMinimumPrice.CreditAllocation.builder() + Price.TieredPackageWithMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2507,32 +2452,29 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredPackageWithMinimumPrice.InvoicingCycleConfiguration.builder() + Price.TieredPackageWithMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackageWithMinimumPrice.InvoicingCycleConfiguration - .DurationUnit + Price.TieredPackageWithMinimum.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.TieredPackageWithMinimumPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.TieredPackageWithMinimum.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredPackageWithMinimumPrice.Maximum.builder() + Price.TieredPackageWithMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredPackageWithMinimumPrice.Metadata.builder() + Price.TieredPackageWithMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredPackageWithMinimumPrice.Minimum.builder() + Price.TieredPackageWithMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2540,14 +2482,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredPackageWithMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredPackageWithMinimum.PriceType.USAGE_PRICE) .tieredPackageWithMinimumConfig( - Price.TieredPackageWithMinimumPrice.TieredPackageWithMinimumConfig.builder() + Price.TieredPackageWithMinimum.TieredPackageWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredPackageWithMinimumPrice.DimensionalPriceConfiguration.builder() + Price.TieredPackageWithMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2557,7 +2499,7 @@ internal class PriceTest { val price = Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -2591,28 +2533,26 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofTieredPackageWithMinimum( - Price.TieredPackageWithMinimumPrice.builder() + Price.TieredPackageWithMinimum.builder() .id("id") .billableMetric( - Price.TieredPackageWithMinimumPrice.BillableMetric.builder() - .id("id") - .build() + Price.TieredPackageWithMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.TieredPackageWithMinimumPrice.BillingCycleConfiguration.builder() + Price.TieredPackageWithMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackageWithMinimumPrice.BillingCycleConfiguration + Price.TieredPackageWithMinimum.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.TieredPackageWithMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.TieredPackageWithMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredPackageWithMinimumPrice.CreditAllocation.builder() + Price.TieredPackageWithMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2630,35 +2570,32 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredPackageWithMinimumPrice.InvoicingCycleConfiguration.builder() + Price.TieredPackageWithMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredPackageWithMinimumPrice.InvoicingCycleConfiguration + Price.TieredPackageWithMinimum.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.TieredPackageWithMinimumPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.TieredPackageWithMinimum.Item.builder().id("id").name("name").build() ) .maximum( - Price.TieredPackageWithMinimumPrice.Maximum.builder() + Price.TieredPackageWithMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredPackageWithMinimumPrice.Metadata.builder() + Price.TieredPackageWithMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredPackageWithMinimumPrice.Minimum.builder() + Price.TieredPackageWithMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2666,14 +2603,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredPackageWithMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredPackageWithMinimum.PriceType.USAGE_PRICE) .tieredPackageWithMinimumConfig( - Price.TieredPackageWithMinimumPrice.TieredPackageWithMinimumConfig.builder() + Price.TieredPackageWithMinimum.TieredPackageWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredPackageWithMinimumPrice.DimensionalPriceConfiguration.builder() + Price.TieredPackageWithMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2690,25 +2627,24 @@ internal class PriceTest { @Test fun ofPackageWithAllocation() { val packageWithAllocation = - Price.PackageWithAllocationPrice.builder() + Price.PackageWithAllocation.builder() .id("id") .billableMetric( - Price.PackageWithAllocationPrice.BillableMetric.builder().id("id").build() + Price.PackageWithAllocation.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.PackageWithAllocationPrice.BillingCycleConfiguration.builder() + Price.PackageWithAllocation.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.PackageWithAllocationPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.PackageWithAllocation.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.PackageWithAllocationPrice.Cadence.ONE_TIME) + .cadence(Price.PackageWithAllocation.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.PackageWithAllocationPrice.CreditAllocation.builder() + Price.PackageWithAllocation.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2726,30 +2662,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.PackageWithAllocationPrice.InvoicingCycleConfiguration.builder() + Price.PackageWithAllocation.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.PackageWithAllocationPrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.PackageWithAllocation.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.PackageWithAllocationPrice.Item.builder().id("id").name("name").build()) + .item(Price.PackageWithAllocation.Item.builder().id("id").name("name").build()) .maximum( - Price.PackageWithAllocationPrice.Maximum.builder() + Price.PackageWithAllocation.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.PackageWithAllocationPrice.Metadata.builder() + Price.PackageWithAllocation.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.PackageWithAllocationPrice.Minimum.builder() + Price.PackageWithAllocation.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2757,14 +2691,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .packageWithAllocationConfig( - Price.PackageWithAllocationPrice.PackageWithAllocationConfig.builder() + Price.PackageWithAllocation.PackageWithAllocationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .planPhaseOrder(0L) - .priceType(Price.PackageWithAllocationPrice.PriceType.USAGE_PRICE) + .priceType(Price.PackageWithAllocation.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.PackageWithAllocationPrice.DimensionalPriceConfiguration.builder() + Price.PackageWithAllocation.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2774,7 +2708,7 @@ internal class PriceTest { val price = Price.ofPackageWithAllocation(packageWithAllocation) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -2808,26 +2742,25 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofPackageWithAllocation( - Price.PackageWithAllocationPrice.builder() + Price.PackageWithAllocation.builder() .id("id") .billableMetric( - Price.PackageWithAllocationPrice.BillableMetric.builder().id("id").build() + Price.PackageWithAllocation.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.PackageWithAllocationPrice.BillingCycleConfiguration.builder() + Price.PackageWithAllocation.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.PackageWithAllocationPrice.BillingCycleConfiguration - .DurationUnit + Price.PackageWithAllocation.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.PackageWithAllocationPrice.Cadence.ONE_TIME) + .cadence(Price.PackageWithAllocation.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.PackageWithAllocationPrice.CreditAllocation.builder() + Price.PackageWithAllocation.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2845,35 +2778,29 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.PackageWithAllocationPrice.InvoicingCycleConfiguration.builder() + Price.PackageWithAllocation.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.PackageWithAllocationPrice.InvoicingCycleConfiguration - .DurationUnit + Price.PackageWithAllocation.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.PackageWithAllocationPrice.Item.builder() - .id("id") - .name("name") - .build() - ) + .item(Price.PackageWithAllocation.Item.builder().id("id").name("name").build()) .maximum( - Price.PackageWithAllocationPrice.Maximum.builder() + Price.PackageWithAllocation.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.PackageWithAllocationPrice.Metadata.builder() + Price.PackageWithAllocation.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.PackageWithAllocationPrice.Minimum.builder() + Price.PackageWithAllocation.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2881,14 +2808,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .packageWithAllocationConfig( - Price.PackageWithAllocationPrice.PackageWithAllocationConfig.builder() + Price.PackageWithAllocation.PackageWithAllocationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .planPhaseOrder(0L) - .priceType(Price.PackageWithAllocationPrice.PriceType.USAGE_PRICE) + .priceType(Price.PackageWithAllocation.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.PackageWithAllocationPrice.DimensionalPriceConfiguration.builder() + Price.PackageWithAllocation.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2905,24 +2832,22 @@ internal class PriceTest { @Test fun ofUnitWithPercent() { val unitWithPercent = - Price.UnitWithPercentPrice.builder() + Price.UnitWithPercent.builder() .id("id") - .billableMetric( - Price.UnitWithPercentPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.UnitWithPercent.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitWithPercentPrice.BillingCycleConfiguration.builder() + Price.UnitWithPercent.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithPercentPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.UnitWithPercent.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitWithPercentPrice.Cadence.ONE_TIME) + .cadence(Price.UnitWithPercent.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitWithPercentPrice.CreditAllocation.builder() + Price.UnitWithPercent.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2940,28 +2865,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitWithPercentPrice.InvoicingCycleConfiguration.builder() + Price.UnitWithPercent.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithPercentPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.UnitWithPercent.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitWithPercentPrice.Item.builder().id("id").name("name").build()) + .item(Price.UnitWithPercent.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitWithPercentPrice.Maximum.builder() + Price.UnitWithPercent.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitWithPercentPrice.Metadata.builder() + Price.UnitWithPercent.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitWithPercentPrice.Minimum.builder() + Price.UnitWithPercent.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2969,14 +2894,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitWithPercentPrice.PriceType.USAGE_PRICE) + .priceType(Price.UnitWithPercent.PriceType.USAGE_PRICE) .unitWithPercentConfig( - Price.UnitWithPercentPrice.UnitWithPercentConfig.builder() + Price.UnitWithPercent.UnitWithPercentConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.UnitWithPercentPrice.DimensionalPriceConfiguration.builder() + Price.UnitWithPercent.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2986,7 +2911,7 @@ internal class PriceTest { val price = Price.ofUnitWithPercent(unitWithPercent) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -3020,25 +2945,22 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofUnitWithPercent( - Price.UnitWithPercentPrice.builder() + Price.UnitWithPercent.builder() .id("id") - .billableMetric( - Price.UnitWithPercentPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.UnitWithPercent.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitWithPercentPrice.BillingCycleConfiguration.builder() + Price.UnitWithPercent.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithPercentPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.UnitWithPercent.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitWithPercentPrice.Cadence.ONE_TIME) + .cadence(Price.UnitWithPercent.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitWithPercentPrice.CreditAllocation.builder() + Price.UnitWithPercent.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3056,29 +2978,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitWithPercentPrice.InvoicingCycleConfiguration.builder() + Price.UnitWithPercent.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithPercentPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.UnitWithPercent.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitWithPercentPrice.Item.builder().id("id").name("name").build()) + .item(Price.UnitWithPercent.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitWithPercentPrice.Maximum.builder() + Price.UnitWithPercent.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitWithPercentPrice.Metadata.builder() + Price.UnitWithPercent.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitWithPercentPrice.Minimum.builder() + Price.UnitWithPercent.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3086,14 +3007,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitWithPercentPrice.PriceType.USAGE_PRICE) + .priceType(Price.UnitWithPercent.PriceType.USAGE_PRICE) .unitWithPercentConfig( - Price.UnitWithPercentPrice.UnitWithPercentConfig.builder() + Price.UnitWithPercent.UnitWithPercentConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.UnitWithPercentPrice.DimensionalPriceConfiguration.builder() + Price.UnitWithPercent.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3110,25 +3031,24 @@ internal class PriceTest { @Test fun ofMatrixWithAllocation() { val matrixWithAllocation = - Price.MatrixWithAllocationPrice.builder() + Price.MatrixWithAllocation.builder() .id("id") .billableMetric( - Price.MatrixWithAllocationPrice.BillableMetric.builder().id("id").build() + Price.MatrixWithAllocation.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.MatrixWithAllocationPrice.BillingCycleConfiguration.builder() + Price.MatrixWithAllocation.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithAllocationPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.MatrixWithAllocation.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.MatrixWithAllocationPrice.Cadence.ONE_TIME) + .cadence(Price.MatrixWithAllocation.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MatrixWithAllocationPrice.CreditAllocation.builder() + Price.MatrixWithAllocation.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3146,22 +3066,21 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MatrixWithAllocationPrice.InvoicingCycleConfiguration.builder() + Price.MatrixWithAllocation.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithAllocationPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.MatrixWithAllocation.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.MatrixWithAllocationPrice.Item.builder().id("id").name("name").build()) + .item(Price.MatrixWithAllocation.Item.builder().id("id").name("name").build()) .matrixWithAllocationConfig( - Price.MatrixWithAllocationPrice.MatrixWithAllocationConfig.builder() + Price.MatrixWithAllocation.MatrixWithAllocationConfig.builder() .allocation(0.0) .defaultUnitAmount("default_unit_amount") .addDimension("string") .addMatrixValue( - Price.MatrixWithAllocationPrice.MatrixWithAllocationConfig.MatrixValue + Price.MatrixWithAllocation.MatrixWithAllocationConfig.MatrixValue .builder() .addDimensionValue("string") .unitAmount("unit_amount") @@ -3170,19 +3089,19 @@ internal class PriceTest { .build() ) .maximum( - Price.MatrixWithAllocationPrice.Maximum.builder() + Price.MatrixWithAllocation.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MatrixWithAllocationPrice.Metadata.builder() + Price.MatrixWithAllocation.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MatrixWithAllocationPrice.Minimum.builder() + Price.MatrixWithAllocation.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3190,9 +3109,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MatrixWithAllocationPrice.PriceType.USAGE_PRICE) + .priceType(Price.MatrixWithAllocation.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MatrixWithAllocationPrice.DimensionalPriceConfiguration.builder() + Price.MatrixWithAllocation.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3202,7 +3121,7 @@ internal class PriceTest { val price = Price.ofMatrixWithAllocation(matrixWithAllocation) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -3236,26 +3155,25 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofMatrixWithAllocation( - Price.MatrixWithAllocationPrice.builder() + Price.MatrixWithAllocation.builder() .id("id") .billableMetric( - Price.MatrixWithAllocationPrice.BillableMetric.builder().id("id").build() + Price.MatrixWithAllocation.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.MatrixWithAllocationPrice.BillingCycleConfiguration.builder() + Price.MatrixWithAllocation.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithAllocationPrice.BillingCycleConfiguration - .DurationUnit + Price.MatrixWithAllocation.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.MatrixWithAllocationPrice.Cadence.ONE_TIME) + .cadence(Price.MatrixWithAllocation.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MatrixWithAllocationPrice.CreditAllocation.builder() + Price.MatrixWithAllocation.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3273,26 +3191,22 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MatrixWithAllocationPrice.InvoicingCycleConfiguration.builder() + Price.MatrixWithAllocation.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithAllocationPrice.InvoicingCycleConfiguration - .DurationUnit + Price.MatrixWithAllocation.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.MatrixWithAllocationPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.MatrixWithAllocation.Item.builder().id("id").name("name").build()) .matrixWithAllocationConfig( - Price.MatrixWithAllocationPrice.MatrixWithAllocationConfig.builder() + Price.MatrixWithAllocation.MatrixWithAllocationConfig.builder() .allocation(0.0) .defaultUnitAmount("default_unit_amount") .addDimension("string") .addMatrixValue( - Price.MatrixWithAllocationPrice.MatrixWithAllocationConfig - .MatrixValue + Price.MatrixWithAllocation.MatrixWithAllocationConfig.MatrixValue .builder() .addDimensionValue("string") .unitAmount("unit_amount") @@ -3301,19 +3215,19 @@ internal class PriceTest { .build() ) .maximum( - Price.MatrixWithAllocationPrice.Maximum.builder() + Price.MatrixWithAllocation.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MatrixWithAllocationPrice.Metadata.builder() + Price.MatrixWithAllocation.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MatrixWithAllocationPrice.Minimum.builder() + Price.MatrixWithAllocation.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3321,9 +3235,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MatrixWithAllocationPrice.PriceType.USAGE_PRICE) + .priceType(Price.MatrixWithAllocation.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MatrixWithAllocationPrice.DimensionalPriceConfiguration.builder() + Price.MatrixWithAllocation.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3340,25 +3254,22 @@ internal class PriceTest { @Test fun ofTieredWithProration() { val tieredWithProration = - Price.TieredWithProrationPrice.builder() + Price.TieredWithProration.builder() .id("id") - .billableMetric( - Price.TieredWithProrationPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.TieredWithProration.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.TieredWithProrationPrice.BillingCycleConfiguration.builder() + Price.TieredWithProration.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithProrationPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.TieredWithProration.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredWithProrationPrice.Cadence.ONE_TIME) + .cadence(Price.TieredWithProration.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredWithProrationPrice.CreditAllocation.builder() + Price.TieredWithProration.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3376,29 +3287,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredWithProrationPrice.InvoicingCycleConfiguration.builder() + Price.TieredWithProration.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithProrationPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.TieredWithProration.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.TieredWithProrationPrice.Item.builder().id("id").name("name").build()) + .item(Price.TieredWithProration.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredWithProrationPrice.Maximum.builder() + Price.TieredWithProration.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredWithProrationPrice.Metadata.builder() + Price.TieredWithProration.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredWithProrationPrice.Minimum.builder() + Price.TieredWithProration.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3406,14 +3316,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredWithProrationPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredWithProration.PriceType.USAGE_PRICE) .tieredWithProrationConfig( - Price.TieredWithProrationPrice.TieredWithProrationConfig.builder() + Price.TieredWithProration.TieredWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredWithProrationPrice.DimensionalPriceConfiguration.builder() + Price.TieredWithProration.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3423,7 +3333,7 @@ internal class PriceTest { val price = Price.ofTieredWithProration(tieredWithProration) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -3457,26 +3367,24 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofTieredWithProration( - Price.TieredWithProrationPrice.builder() + Price.TieredWithProration.builder() .id("id") .billableMetric( - Price.TieredWithProrationPrice.BillableMetric.builder().id("id").build() + Price.TieredWithProration.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.TieredWithProrationPrice.BillingCycleConfiguration.builder() + Price.TieredWithProration.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithProrationPrice.BillingCycleConfiguration - .DurationUnit - .DAY + Price.TieredWithProration.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.TieredWithProrationPrice.Cadence.ONE_TIME) + .cadence(Price.TieredWithProration.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.TieredWithProrationPrice.CreditAllocation.builder() + Price.TieredWithProration.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3494,32 +3402,29 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.TieredWithProrationPrice.InvoicingCycleConfiguration.builder() + Price.TieredWithProration.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.TieredWithProrationPrice.InvoicingCycleConfiguration - .DurationUnit + Price.TieredWithProration.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.TieredWithProrationPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.TieredWithProration.Item.builder().id("id").name("name").build()) .maximum( - Price.TieredWithProrationPrice.Maximum.builder() + Price.TieredWithProration.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.TieredWithProrationPrice.Metadata.builder() + Price.TieredWithProration.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.TieredWithProrationPrice.Minimum.builder() + Price.TieredWithProration.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3527,14 +3432,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.TieredWithProrationPrice.PriceType.USAGE_PRICE) + .priceType(Price.TieredWithProration.PriceType.USAGE_PRICE) .tieredWithProrationConfig( - Price.TieredWithProrationPrice.TieredWithProrationConfig.builder() + Price.TieredWithProration.TieredWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.TieredWithProrationPrice.DimensionalPriceConfiguration.builder() + Price.TieredWithProration.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3551,24 +3456,22 @@ internal class PriceTest { @Test fun ofUnitWithProration() { val unitWithProration = - Price.UnitWithProrationPrice.builder() + Price.UnitWithProration.builder() .id("id") - .billableMetric( - Price.UnitWithProrationPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.UnitWithProration.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitWithProrationPrice.BillingCycleConfiguration.builder() + Price.UnitWithProration.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithProrationPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.UnitWithProration.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitWithProrationPrice.Cadence.ONE_TIME) + .cadence(Price.UnitWithProration.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitWithProrationPrice.CreditAllocation.builder() + Price.UnitWithProration.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3586,29 +3489,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitWithProrationPrice.InvoicingCycleConfiguration.builder() + Price.UnitWithProration.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithProrationPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.UnitWithProration.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitWithProrationPrice.Item.builder().id("id").name("name").build()) + .item(Price.UnitWithProration.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitWithProrationPrice.Maximum.builder() + Price.UnitWithProration.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitWithProrationPrice.Metadata.builder() + Price.UnitWithProration.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitWithProrationPrice.Minimum.builder() + Price.UnitWithProration.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3616,14 +3518,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitWithProrationPrice.PriceType.USAGE_PRICE) + .priceType(Price.UnitWithProration.PriceType.USAGE_PRICE) .unitWithProrationConfig( - Price.UnitWithProrationPrice.UnitWithProrationConfig.builder() + Price.UnitWithProration.UnitWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.UnitWithProrationPrice.DimensionalPriceConfiguration.builder() + Price.UnitWithProration.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3633,7 +3535,7 @@ internal class PriceTest { val price = Price.ofUnitWithProration(unitWithProration) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -3667,25 +3569,24 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofUnitWithProration( - Price.UnitWithProrationPrice.builder() + Price.UnitWithProration.builder() .id("id") .billableMetric( - Price.UnitWithProrationPrice.BillableMetric.builder().id("id").build() + Price.UnitWithProration.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitWithProrationPrice.BillingCycleConfiguration.builder() + Price.UnitWithProration.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithProrationPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.UnitWithProration.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitWithProrationPrice.Cadence.ONE_TIME) + .cadence(Price.UnitWithProration.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitWithProrationPrice.CreditAllocation.builder() + Price.UnitWithProration.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3703,30 +3604,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitWithProrationPrice.InvoicingCycleConfiguration.builder() + Price.UnitWithProration.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitWithProrationPrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.UnitWithProration.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitWithProrationPrice.Item.builder().id("id").name("name").build()) + .item(Price.UnitWithProration.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitWithProrationPrice.Maximum.builder() + Price.UnitWithProration.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitWithProrationPrice.Metadata.builder() + Price.UnitWithProration.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitWithProrationPrice.Minimum.builder() + Price.UnitWithProration.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3734,14 +3633,14 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitWithProrationPrice.PriceType.USAGE_PRICE) + .priceType(Price.UnitWithProration.PriceType.USAGE_PRICE) .unitWithProrationConfig( - Price.UnitWithProrationPrice.UnitWithProrationConfig.builder() + Price.UnitWithProration.UnitWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.UnitWithProrationPrice.DimensionalPriceConfiguration.builder() + Price.UnitWithProration.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3758,24 +3657,22 @@ internal class PriceTest { @Test fun ofGroupedAllocation() { val groupedAllocation = - Price.GroupedAllocationPrice.builder() + Price.GroupedAllocation.builder() .id("id") - .billableMetric( - Price.GroupedAllocationPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.GroupedAllocation.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.GroupedAllocationPrice.BillingCycleConfiguration.builder() + Price.GroupedAllocation.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedAllocationPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.GroupedAllocation.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.GroupedAllocationPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedAllocation.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedAllocationPrice.CreditAllocation.builder() + Price.GroupedAllocation.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3793,34 +3690,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedAllocationConfig( - Price.GroupedAllocationPrice.GroupedAllocationConfig.builder() + Price.GroupedAllocation.GroupedAllocationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedAllocationPrice.InvoicingCycleConfiguration.builder() + Price.GroupedAllocation.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedAllocationPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.GroupedAllocation.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.GroupedAllocationPrice.Item.builder().id("id").name("name").build()) + .item(Price.GroupedAllocation.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedAllocationPrice.Maximum.builder() + Price.GroupedAllocation.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedAllocationPrice.Metadata.builder() + Price.GroupedAllocation.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedAllocationPrice.Minimum.builder() + Price.GroupedAllocation.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3828,9 +3724,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedAllocationPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedAllocation.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedAllocationPrice.DimensionalPriceConfiguration.builder() + Price.GroupedAllocation.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3840,7 +3736,7 @@ internal class PriceTest { val price = Price.ofGroupedAllocation(groupedAllocation) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -3874,25 +3770,24 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofGroupedAllocation( - Price.GroupedAllocationPrice.builder() + Price.GroupedAllocation.builder() .id("id") .billableMetric( - Price.GroupedAllocationPrice.BillableMetric.builder().id("id").build() + Price.GroupedAllocation.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedAllocationPrice.BillingCycleConfiguration.builder() + Price.GroupedAllocation.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedAllocationPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.GroupedAllocation.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.GroupedAllocationPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedAllocation.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedAllocationPrice.CreditAllocation.builder() + Price.GroupedAllocation.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3910,35 +3805,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedAllocationConfig( - Price.GroupedAllocationPrice.GroupedAllocationConfig.builder() + Price.GroupedAllocation.GroupedAllocationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedAllocationPrice.InvoicingCycleConfiguration.builder() + Price.GroupedAllocation.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedAllocationPrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.GroupedAllocation.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.GroupedAllocationPrice.Item.builder().id("id").name("name").build()) + .item(Price.GroupedAllocation.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedAllocationPrice.Maximum.builder() + Price.GroupedAllocation.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedAllocationPrice.Metadata.builder() + Price.GroupedAllocation.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedAllocationPrice.Minimum.builder() + Price.GroupedAllocation.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3946,9 +3839,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedAllocationPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedAllocation.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedAllocationPrice.DimensionalPriceConfiguration.builder() + Price.GroupedAllocation.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3965,26 +3858,25 @@ internal class PriceTest { @Test fun ofGroupedWithProratedMinimum() { val groupedWithProratedMinimum = - Price.GroupedWithProratedMinimumPrice.builder() + Price.GroupedWithProratedMinimum.builder() .id("id") .billableMetric( - Price.GroupedWithProratedMinimumPrice.BillableMetric.builder().id("id").build() + Price.GroupedWithProratedMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedWithProratedMinimumPrice.BillingCycleConfiguration.builder() + Price.GroupedWithProratedMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithProratedMinimumPrice.BillingCycleConfiguration - .DurationUnit + Price.GroupedWithProratedMinimum.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.GroupedWithProratedMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedWithProratedMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedWithProratedMinimumPrice.CreditAllocation.builder() + Price.GroupedWithProratedMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4002,40 +3894,35 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedWithProratedMinimumConfig( - Price.GroupedWithProratedMinimumPrice.GroupedWithProratedMinimumConfig.builder() + Price.GroupedWithProratedMinimum.GroupedWithProratedMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedWithProratedMinimumPrice.InvoicingCycleConfiguration.builder() + Price.GroupedWithProratedMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithProratedMinimumPrice.InvoicingCycleConfiguration + Price.GroupedWithProratedMinimum.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) - .item( - Price.GroupedWithProratedMinimumPrice.Item.builder() - .id("id") - .name("name") - .build() - ) + .item(Price.GroupedWithProratedMinimum.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedWithProratedMinimumPrice.Maximum.builder() + Price.GroupedWithProratedMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedWithProratedMinimumPrice.Metadata.builder() + Price.GroupedWithProratedMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedWithProratedMinimumPrice.Minimum.builder() + Price.GroupedWithProratedMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4043,9 +3930,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedWithProratedMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedWithProratedMinimum.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedWithProratedMinimumPrice.DimensionalPriceConfiguration.builder() + Price.GroupedWithProratedMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4055,7 +3942,7 @@ internal class PriceTest { val price = Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -4089,28 +3976,26 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofGroupedWithProratedMinimum( - Price.GroupedWithProratedMinimumPrice.builder() + Price.GroupedWithProratedMinimum.builder() .id("id") .billableMetric( - Price.GroupedWithProratedMinimumPrice.BillableMetric.builder() - .id("id") - .build() + Price.GroupedWithProratedMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedWithProratedMinimumPrice.BillingCycleConfiguration.builder() + Price.GroupedWithProratedMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithProratedMinimumPrice.BillingCycleConfiguration + Price.GroupedWithProratedMinimum.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.GroupedWithProratedMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedWithProratedMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedWithProratedMinimumPrice.CreditAllocation.builder() + Price.GroupedWithProratedMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4128,41 +4013,40 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedWithProratedMinimumConfig( - Price.GroupedWithProratedMinimumPrice.GroupedWithProratedMinimumConfig - .builder() + Price.GroupedWithProratedMinimum.GroupedWithProratedMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedWithProratedMinimumPrice.InvoicingCycleConfiguration.builder() + Price.GroupedWithProratedMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithProratedMinimumPrice.InvoicingCycleConfiguration + Price.GroupedWithProratedMinimum.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.GroupedWithProratedMinimumPrice.Item.builder() + Price.GroupedWithProratedMinimum.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.GroupedWithProratedMinimumPrice.Maximum.builder() + Price.GroupedWithProratedMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedWithProratedMinimumPrice.Metadata.builder() + Price.GroupedWithProratedMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedWithProratedMinimumPrice.Minimum.builder() + Price.GroupedWithProratedMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4170,10 +4054,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedWithProratedMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedWithProratedMinimum.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedWithProratedMinimumPrice.DimensionalPriceConfiguration - .builder() + Price.GroupedWithProratedMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4190,26 +4073,25 @@ internal class PriceTest { @Test fun ofGroupedWithMeteredMinimum() { val groupedWithMeteredMinimum = - Price.GroupedWithMeteredMinimumPrice.builder() + Price.GroupedWithMeteredMinimum.builder() .id("id") .billableMetric( - Price.GroupedWithMeteredMinimumPrice.BillableMetric.builder().id("id").build() + Price.GroupedWithMeteredMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedWithMeteredMinimumPrice.BillingCycleConfiguration.builder() + Price.GroupedWithMeteredMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithMeteredMinimumPrice.BillingCycleConfiguration - .DurationUnit + Price.GroupedWithMeteredMinimum.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.GroupedWithMeteredMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedWithMeteredMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedWithMeteredMinimumPrice.CreditAllocation.builder() + Price.GroupedWithMeteredMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4227,40 +4109,34 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedWithMeteredMinimumConfig( - Price.GroupedWithMeteredMinimumPrice.GroupedWithMeteredMinimumConfig.builder() + Price.GroupedWithMeteredMinimum.GroupedWithMeteredMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedWithMeteredMinimumPrice.InvoicingCycleConfiguration.builder() + Price.GroupedWithMeteredMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithMeteredMinimumPrice.InvoicingCycleConfiguration - .DurationUnit + Price.GroupedWithMeteredMinimum.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.GroupedWithMeteredMinimumPrice.Item.builder() - .id("id") - .name("name") - .build() - ) + .item(Price.GroupedWithMeteredMinimum.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedWithMeteredMinimumPrice.Maximum.builder() + Price.GroupedWithMeteredMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedWithMeteredMinimumPrice.Metadata.builder() + Price.GroupedWithMeteredMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedWithMeteredMinimumPrice.Minimum.builder() + Price.GroupedWithMeteredMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4268,9 +4144,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedWithMeteredMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedWithMeteredMinimum.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedWithMeteredMinimumPrice.DimensionalPriceConfiguration.builder() + Price.GroupedWithMeteredMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4280,7 +4156,7 @@ internal class PriceTest { val price = Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -4314,28 +4190,26 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofGroupedWithMeteredMinimum( - Price.GroupedWithMeteredMinimumPrice.builder() + Price.GroupedWithMeteredMinimum.builder() .id("id") .billableMetric( - Price.GroupedWithMeteredMinimumPrice.BillableMetric.builder() - .id("id") - .build() + Price.GroupedWithMeteredMinimum.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedWithMeteredMinimumPrice.BillingCycleConfiguration.builder() + Price.GroupedWithMeteredMinimum.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithMeteredMinimumPrice.BillingCycleConfiguration + Price.GroupedWithMeteredMinimum.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.GroupedWithMeteredMinimumPrice.Cadence.ONE_TIME) + .cadence(Price.GroupedWithMeteredMinimum.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedWithMeteredMinimumPrice.CreditAllocation.builder() + Price.GroupedWithMeteredMinimum.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4353,41 +4227,37 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedWithMeteredMinimumConfig( - Price.GroupedWithMeteredMinimumPrice.GroupedWithMeteredMinimumConfig - .builder() + Price.GroupedWithMeteredMinimum.GroupedWithMeteredMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedWithMeteredMinimumPrice.InvoicingCycleConfiguration.builder() + Price.GroupedWithMeteredMinimum.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedWithMeteredMinimumPrice.InvoicingCycleConfiguration + Price.GroupedWithMeteredMinimum.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.GroupedWithMeteredMinimumPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.GroupedWithMeteredMinimum.Item.builder().id("id").name("name").build() ) .maximum( - Price.GroupedWithMeteredMinimumPrice.Maximum.builder() + Price.GroupedWithMeteredMinimum.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedWithMeteredMinimumPrice.Metadata.builder() + Price.GroupedWithMeteredMinimum.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedWithMeteredMinimumPrice.Minimum.builder() + Price.GroupedWithMeteredMinimum.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4395,9 +4265,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedWithMeteredMinimumPrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedWithMeteredMinimum.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedWithMeteredMinimumPrice.DimensionalPriceConfiguration.builder() + Price.GroupedWithMeteredMinimum.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4414,25 +4284,24 @@ internal class PriceTest { @Test fun ofMatrixWithDisplayName() { val matrixWithDisplayName = - Price.MatrixWithDisplayNamePrice.builder() + Price.MatrixWithDisplayName.builder() .id("id") .billableMetric( - Price.MatrixWithDisplayNamePrice.BillableMetric.builder().id("id").build() + Price.MatrixWithDisplayName.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.MatrixWithDisplayNamePrice.BillingCycleConfiguration.builder() + Price.MatrixWithDisplayName.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithDisplayNamePrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.MatrixWithDisplayName.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.MatrixWithDisplayNamePrice.Cadence.ONE_TIME) + .cadence(Price.MatrixWithDisplayName.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MatrixWithDisplayNamePrice.CreditAllocation.builder() + Price.MatrixWithDisplayName.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4450,35 +4319,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MatrixWithDisplayNamePrice.InvoicingCycleConfiguration.builder() + Price.MatrixWithDisplayName.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithDisplayNamePrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.MatrixWithDisplayName.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.MatrixWithDisplayNamePrice.Item.builder().id("id").name("name").build()) + .item(Price.MatrixWithDisplayName.Item.builder().id("id").name("name").build()) .matrixWithDisplayNameConfig( - Price.MatrixWithDisplayNamePrice.MatrixWithDisplayNameConfig.builder() + Price.MatrixWithDisplayName.MatrixWithDisplayNameConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .maximum( - Price.MatrixWithDisplayNamePrice.Maximum.builder() + Price.MatrixWithDisplayName.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MatrixWithDisplayNamePrice.Metadata.builder() + Price.MatrixWithDisplayName.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MatrixWithDisplayNamePrice.Minimum.builder() + Price.MatrixWithDisplayName.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4486,9 +4353,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MatrixWithDisplayNamePrice.PriceType.USAGE_PRICE) + .priceType(Price.MatrixWithDisplayName.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MatrixWithDisplayNamePrice.DimensionalPriceConfiguration.builder() + Price.MatrixWithDisplayName.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4498,7 +4365,7 @@ internal class PriceTest { val price = Price.ofMatrixWithDisplayName(matrixWithDisplayName) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -4532,26 +4399,25 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofMatrixWithDisplayName( - Price.MatrixWithDisplayNamePrice.builder() + Price.MatrixWithDisplayName.builder() .id("id") .billableMetric( - Price.MatrixWithDisplayNamePrice.BillableMetric.builder().id("id").build() + Price.MatrixWithDisplayName.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.MatrixWithDisplayNamePrice.BillingCycleConfiguration.builder() + Price.MatrixWithDisplayName.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithDisplayNamePrice.BillingCycleConfiguration - .DurationUnit + Price.MatrixWithDisplayName.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.MatrixWithDisplayNamePrice.Cadence.ONE_TIME) + .cadence(Price.MatrixWithDisplayName.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MatrixWithDisplayNamePrice.CreditAllocation.builder() + Price.MatrixWithDisplayName.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4569,40 +4435,34 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MatrixWithDisplayNamePrice.InvoicingCycleConfiguration.builder() + Price.MatrixWithDisplayName.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MatrixWithDisplayNamePrice.InvoicingCycleConfiguration - .DurationUnit + Price.MatrixWithDisplayName.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.MatrixWithDisplayNamePrice.Item.builder() - .id("id") - .name("name") - .build() - ) + .item(Price.MatrixWithDisplayName.Item.builder().id("id").name("name").build()) .matrixWithDisplayNameConfig( - Price.MatrixWithDisplayNamePrice.MatrixWithDisplayNameConfig.builder() + Price.MatrixWithDisplayName.MatrixWithDisplayNameConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .maximum( - Price.MatrixWithDisplayNamePrice.Maximum.builder() + Price.MatrixWithDisplayName.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MatrixWithDisplayNamePrice.Metadata.builder() + Price.MatrixWithDisplayName.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MatrixWithDisplayNamePrice.Minimum.builder() + Price.MatrixWithDisplayName.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4610,9 +4470,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MatrixWithDisplayNamePrice.PriceType.USAGE_PRICE) + .priceType(Price.MatrixWithDisplayName.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MatrixWithDisplayNamePrice.DimensionalPriceConfiguration.builder() + Price.MatrixWithDisplayName.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4629,29 +4489,27 @@ internal class PriceTest { @Test fun ofBulkWithProration() { val bulkWithProration = - Price.BulkWithProrationPrice.builder() + Price.BulkWithProration.builder() .id("id") - .billableMetric( - Price.BulkWithProrationPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.BulkWithProration.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.BulkWithProrationPrice.BillingCycleConfiguration.builder() + Price.BulkWithProration.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.BulkWithProrationPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.BulkWithProration.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) .bulkWithProrationConfig( - Price.BulkWithProrationPrice.BulkWithProrationConfig.builder() + Price.BulkWithProration.BulkWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .cadence(Price.BulkWithProrationPrice.Cadence.ONE_TIME) + .cadence(Price.BulkWithProration.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BulkWithProrationPrice.CreditAllocation.builder() + Price.BulkWithProration.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4669,29 +4527,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BulkWithProrationPrice.InvoicingCycleConfiguration.builder() + Price.BulkWithProration.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.BulkWithProrationPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.BulkWithProration.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.BulkWithProrationPrice.Item.builder().id("id").name("name").build()) + .item(Price.BulkWithProration.Item.builder().id("id").name("name").build()) .maximum( - Price.BulkWithProrationPrice.Maximum.builder() + Price.BulkWithProration.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BulkWithProrationPrice.Metadata.builder() + Price.BulkWithProration.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BulkWithProrationPrice.Minimum.builder() + Price.BulkWithProration.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4699,9 +4556,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BulkWithProrationPrice.PriceType.USAGE_PRICE) + .priceType(Price.BulkWithProration.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BulkWithProrationPrice.DimensionalPriceConfiguration.builder() + Price.BulkWithProration.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4711,7 +4568,7 @@ internal class PriceTest { val price = Price.ofBulkWithProration(bulkWithProration) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -4745,30 +4602,29 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofBulkWithProration( - Price.BulkWithProrationPrice.builder() + Price.BulkWithProration.builder() .id("id") .billableMetric( - Price.BulkWithProrationPrice.BillableMetric.builder().id("id").build() + Price.BulkWithProration.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.BulkWithProrationPrice.BillingCycleConfiguration.builder() + Price.BulkWithProration.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.BulkWithProrationPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.BulkWithProration.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) .bulkWithProrationConfig( - Price.BulkWithProrationPrice.BulkWithProrationConfig.builder() + Price.BulkWithProration.BulkWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .cadence(Price.BulkWithProrationPrice.Cadence.ONE_TIME) + .cadence(Price.BulkWithProration.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.BulkWithProrationPrice.CreditAllocation.builder() + Price.BulkWithProration.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4786,30 +4642,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.BulkWithProrationPrice.InvoicingCycleConfiguration.builder() + Price.BulkWithProration.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.BulkWithProrationPrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.BulkWithProration.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.BulkWithProrationPrice.Item.builder().id("id").name("name").build()) + .item(Price.BulkWithProration.Item.builder().id("id").name("name").build()) .maximum( - Price.BulkWithProrationPrice.Maximum.builder() + Price.BulkWithProration.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.BulkWithProrationPrice.Metadata.builder() + Price.BulkWithProration.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.BulkWithProrationPrice.Minimum.builder() + Price.BulkWithProration.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4817,9 +4671,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.BulkWithProrationPrice.PriceType.USAGE_PRICE) + .priceType(Price.BulkWithProration.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.BulkWithProrationPrice.DimensionalPriceConfiguration.builder() + Price.BulkWithProration.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4836,25 +4690,24 @@ internal class PriceTest { @Test fun ofGroupedTieredPackage() { val groupedTieredPackage = - Price.GroupedTieredPackagePrice.builder() + Price.GroupedTieredPackage.builder() .id("id") .billableMetric( - Price.GroupedTieredPackagePrice.BillableMetric.builder().id("id").build() + Price.GroupedTieredPackage.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedTieredPackagePrice.BillingCycleConfiguration.builder() + Price.GroupedTieredPackage.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPackagePrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.GroupedTieredPackage.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.GroupedTieredPackagePrice.Cadence.ONE_TIME) + .cadence(Price.GroupedTieredPackage.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedTieredPackagePrice.CreditAllocation.builder() + Price.GroupedTieredPackage.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4872,34 +4725,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedTieredPackageConfig( - Price.GroupedTieredPackagePrice.GroupedTieredPackageConfig.builder() + Price.GroupedTieredPackage.GroupedTieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedTieredPackagePrice.InvoicingCycleConfiguration.builder() + Price.GroupedTieredPackage.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPackagePrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.GroupedTieredPackage.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.GroupedTieredPackagePrice.Item.builder().id("id").name("name").build()) + .item(Price.GroupedTieredPackage.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedTieredPackagePrice.Maximum.builder() + Price.GroupedTieredPackage.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedTieredPackagePrice.Metadata.builder() + Price.GroupedTieredPackage.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedTieredPackagePrice.Minimum.builder() + Price.GroupedTieredPackage.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4907,9 +4759,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedTieredPackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedTieredPackage.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedTieredPackagePrice.DimensionalPriceConfiguration.builder() + Price.GroupedTieredPackage.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -4919,7 +4771,7 @@ internal class PriceTest { val price = Price.ofGroupedTieredPackage(groupedTieredPackage) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -4953,26 +4805,25 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofGroupedTieredPackage( - Price.GroupedTieredPackagePrice.builder() + Price.GroupedTieredPackage.builder() .id("id") .billableMetric( - Price.GroupedTieredPackagePrice.BillableMetric.builder().id("id").build() + Price.GroupedTieredPackage.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.GroupedTieredPackagePrice.BillingCycleConfiguration.builder() + Price.GroupedTieredPackage.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPackagePrice.BillingCycleConfiguration - .DurationUnit + Price.GroupedTieredPackage.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.GroupedTieredPackagePrice.Cadence.ONE_TIME) + .cadence(Price.GroupedTieredPackage.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.GroupedTieredPackagePrice.CreditAllocation.builder() + Price.GroupedTieredPackage.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4990,37 +4841,34 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .groupedTieredPackageConfig( - Price.GroupedTieredPackagePrice.GroupedTieredPackageConfig.builder() + Price.GroupedTieredPackage.GroupedTieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .invoicingCycleConfiguration( - Price.GroupedTieredPackagePrice.InvoicingCycleConfiguration.builder() + Price.GroupedTieredPackage.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.GroupedTieredPackagePrice.InvoicingCycleConfiguration - .DurationUnit + Price.GroupedTieredPackage.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.GroupedTieredPackagePrice.Item.builder().id("id").name("name").build() - ) + .item(Price.GroupedTieredPackage.Item.builder().id("id").name("name").build()) .maximum( - Price.GroupedTieredPackagePrice.Maximum.builder() + Price.GroupedTieredPackage.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.GroupedTieredPackagePrice.Metadata.builder() + Price.GroupedTieredPackage.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.GroupedTieredPackagePrice.Minimum.builder() + Price.GroupedTieredPackage.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5028,9 +4876,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.GroupedTieredPackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.GroupedTieredPackage.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.GroupedTieredPackagePrice.DimensionalPriceConfiguration.builder() + Price.GroupedTieredPackage.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5047,25 +4895,24 @@ internal class PriceTest { @Test fun ofMaxGroupTieredPackage() { val maxGroupTieredPackage = - Price.MaxGroupTieredPackagePrice.builder() + Price.MaxGroupTieredPackage.builder() .id("id") .billableMetric( - Price.MaxGroupTieredPackagePrice.BillableMetric.builder().id("id").build() + Price.MaxGroupTieredPackage.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.MaxGroupTieredPackagePrice.BillingCycleConfiguration.builder() + Price.MaxGroupTieredPackage.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MaxGroupTieredPackagePrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.MaxGroupTieredPackage.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.MaxGroupTieredPackagePrice.Cadence.ONE_TIME) + .cadence(Price.MaxGroupTieredPackage.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MaxGroupTieredPackagePrice.CreditAllocation.builder() + Price.MaxGroupTieredPackage.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -5083,35 +4930,33 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MaxGroupTieredPackagePrice.InvoicingCycleConfiguration.builder() + Price.MaxGroupTieredPackage.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MaxGroupTieredPackagePrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.MaxGroupTieredPackage.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.MaxGroupTieredPackagePrice.Item.builder().id("id").name("name").build()) + .item(Price.MaxGroupTieredPackage.Item.builder().id("id").name("name").build()) .maxGroupTieredPackageConfig( - Price.MaxGroupTieredPackagePrice.MaxGroupTieredPackageConfig.builder() + Price.MaxGroupTieredPackage.MaxGroupTieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .maximum( - Price.MaxGroupTieredPackagePrice.Maximum.builder() + Price.MaxGroupTieredPackage.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MaxGroupTieredPackagePrice.Metadata.builder() + Price.MaxGroupTieredPackage.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MaxGroupTieredPackagePrice.Minimum.builder() + Price.MaxGroupTieredPackage.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5119,9 +4964,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MaxGroupTieredPackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.MaxGroupTieredPackage.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MaxGroupTieredPackagePrice.DimensionalPriceConfiguration.builder() + Price.MaxGroupTieredPackage.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5131,7 +4976,7 @@ internal class PriceTest { val price = Price.ofMaxGroupTieredPackage(maxGroupTieredPackage) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -5165,26 +5010,25 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofMaxGroupTieredPackage( - Price.MaxGroupTieredPackagePrice.builder() + Price.MaxGroupTieredPackage.builder() .id("id") .billableMetric( - Price.MaxGroupTieredPackagePrice.BillableMetric.builder().id("id").build() + Price.MaxGroupTieredPackage.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.MaxGroupTieredPackagePrice.BillingCycleConfiguration.builder() + Price.MaxGroupTieredPackage.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MaxGroupTieredPackagePrice.BillingCycleConfiguration - .DurationUnit + Price.MaxGroupTieredPackage.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.MaxGroupTieredPackagePrice.Cadence.ONE_TIME) + .cadence(Price.MaxGroupTieredPackage.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.MaxGroupTieredPackagePrice.CreditAllocation.builder() + Price.MaxGroupTieredPackage.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -5202,40 +5046,34 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.MaxGroupTieredPackagePrice.InvoicingCycleConfiguration.builder() + Price.MaxGroupTieredPackage.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.MaxGroupTieredPackagePrice.InvoicingCycleConfiguration - .DurationUnit + Price.MaxGroupTieredPackage.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.MaxGroupTieredPackagePrice.Item.builder() - .id("id") - .name("name") - .build() - ) + .item(Price.MaxGroupTieredPackage.Item.builder().id("id").name("name").build()) .maxGroupTieredPackageConfig( - Price.MaxGroupTieredPackagePrice.MaxGroupTieredPackageConfig.builder() + Price.MaxGroupTieredPackage.MaxGroupTieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .maximum( - Price.MaxGroupTieredPackagePrice.Maximum.builder() + Price.MaxGroupTieredPackage.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.MaxGroupTieredPackagePrice.Metadata.builder() + Price.MaxGroupTieredPackage.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.MaxGroupTieredPackagePrice.Minimum.builder() + Price.MaxGroupTieredPackage.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5243,9 +5081,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.MaxGroupTieredPackagePrice.PriceType.USAGE_PRICE) + .priceType(Price.MaxGroupTieredPackage.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.MaxGroupTieredPackagePrice.DimensionalPriceConfiguration.builder() + Price.MaxGroupTieredPackage.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5262,28 +5100,26 @@ internal class PriceTest { @Test fun ofScalableMatrixWithUnitPricing() { val scalableMatrixWithUnitPricing = - Price.ScalableMatrixWithUnitPricingPrice.builder() + Price.ScalableMatrixWithUnitPricing.builder() .id("id") .billableMetric( - Price.ScalableMatrixWithUnitPricingPrice.BillableMetric.builder() - .id("id") - .build() + Price.ScalableMatrixWithUnitPricing.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.ScalableMatrixWithUnitPricingPrice.BillingCycleConfiguration.builder() + Price.ScalableMatrixWithUnitPricing.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithUnitPricingPrice.BillingCycleConfiguration + Price.ScalableMatrixWithUnitPricing.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.ScalableMatrixWithUnitPricingPrice.Cadence.ONE_TIME) + .cadence(Price.ScalableMatrixWithUnitPricing.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.ScalableMatrixWithUnitPricingPrice.CreditAllocation.builder() + Price.ScalableMatrixWithUnitPricing.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -5301,35 +5137,32 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.ScalableMatrixWithUnitPricingPrice.InvoicingCycleConfiguration.builder() + Price.ScalableMatrixWithUnitPricing.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithUnitPricingPrice.InvoicingCycleConfiguration + Price.ScalableMatrixWithUnitPricing.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.ScalableMatrixWithUnitPricingPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.ScalableMatrixWithUnitPricing.Item.builder().id("id").name("name").build() ) .maximum( - Price.ScalableMatrixWithUnitPricingPrice.Maximum.builder() + Price.ScalableMatrixWithUnitPricing.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.ScalableMatrixWithUnitPricingPrice.Metadata.builder() + Price.ScalableMatrixWithUnitPricing.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.ScalableMatrixWithUnitPricingPrice.Minimum.builder() + Price.ScalableMatrixWithUnitPricing.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5337,15 +5170,15 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.ScalableMatrixWithUnitPricingPrice.PriceType.USAGE_PRICE) + .priceType(Price.ScalableMatrixWithUnitPricing.PriceType.USAGE_PRICE) .scalableMatrixWithUnitPricingConfig( - Price.ScalableMatrixWithUnitPricingPrice.ScalableMatrixWithUnitPricingConfig + Price.ScalableMatrixWithUnitPricing.ScalableMatrixWithUnitPricingConfig .builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.ScalableMatrixWithUnitPricingPrice.DimensionalPriceConfiguration.builder() + Price.ScalableMatrixWithUnitPricing.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5355,7 +5188,7 @@ internal class PriceTest { val price = Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -5389,28 +5222,28 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofScalableMatrixWithUnitPricing( - Price.ScalableMatrixWithUnitPricingPrice.builder() + Price.ScalableMatrixWithUnitPricing.builder() .id("id") .billableMetric( - Price.ScalableMatrixWithUnitPricingPrice.BillableMetric.builder() + Price.ScalableMatrixWithUnitPricing.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.ScalableMatrixWithUnitPricingPrice.BillingCycleConfiguration.builder() + Price.ScalableMatrixWithUnitPricing.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithUnitPricingPrice.BillingCycleConfiguration + Price.ScalableMatrixWithUnitPricing.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.ScalableMatrixWithUnitPricingPrice.Cadence.ONE_TIME) + .cadence(Price.ScalableMatrixWithUnitPricing.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.ScalableMatrixWithUnitPricingPrice.CreditAllocation.builder() + Price.ScalableMatrixWithUnitPricing.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -5428,36 +5261,35 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.ScalableMatrixWithUnitPricingPrice.InvoicingCycleConfiguration - .builder() + Price.ScalableMatrixWithUnitPricing.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithUnitPricingPrice.InvoicingCycleConfiguration + Price.ScalableMatrixWithUnitPricing.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.ScalableMatrixWithUnitPricingPrice.Item.builder() + Price.ScalableMatrixWithUnitPricing.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.ScalableMatrixWithUnitPricingPrice.Maximum.builder() + Price.ScalableMatrixWithUnitPricing.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.ScalableMatrixWithUnitPricingPrice.Metadata.builder() + Price.ScalableMatrixWithUnitPricing.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.ScalableMatrixWithUnitPricingPrice.Minimum.builder() + Price.ScalableMatrixWithUnitPricing.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5465,16 +5297,15 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.ScalableMatrixWithUnitPricingPrice.PriceType.USAGE_PRICE) + .priceType(Price.ScalableMatrixWithUnitPricing.PriceType.USAGE_PRICE) .scalableMatrixWithUnitPricingConfig( - Price.ScalableMatrixWithUnitPricingPrice.ScalableMatrixWithUnitPricingConfig + Price.ScalableMatrixWithUnitPricing.ScalableMatrixWithUnitPricingConfig .builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.ScalableMatrixWithUnitPricingPrice.DimensionalPriceConfiguration - .builder() + Price.ScalableMatrixWithUnitPricing.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5491,28 +5322,26 @@ internal class PriceTest { @Test fun ofScalableMatrixWithTieredPricing() { val scalableMatrixWithTieredPricing = - Price.ScalableMatrixWithTieredPricingPrice.builder() + Price.ScalableMatrixWithTieredPricing.builder() .id("id") .billableMetric( - Price.ScalableMatrixWithTieredPricingPrice.BillableMetric.builder() - .id("id") - .build() + Price.ScalableMatrixWithTieredPricing.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.ScalableMatrixWithTieredPricingPrice.BillingCycleConfiguration.builder() + Price.ScalableMatrixWithTieredPricing.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithTieredPricingPrice.BillingCycleConfiguration + Price.ScalableMatrixWithTieredPricing.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.ScalableMatrixWithTieredPricingPrice.Cadence.ONE_TIME) + .cadence(Price.ScalableMatrixWithTieredPricing.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.ScalableMatrixWithTieredPricingPrice.CreditAllocation.builder() + Price.ScalableMatrixWithTieredPricing.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -5530,35 +5359,35 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.ScalableMatrixWithTieredPricingPrice.InvoicingCycleConfiguration.builder() + Price.ScalableMatrixWithTieredPricing.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithTieredPricingPrice.InvoicingCycleConfiguration + Price.ScalableMatrixWithTieredPricing.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.ScalableMatrixWithTieredPricingPrice.Item.builder() + Price.ScalableMatrixWithTieredPricing.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.ScalableMatrixWithTieredPricingPrice.Maximum.builder() + Price.ScalableMatrixWithTieredPricing.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.ScalableMatrixWithTieredPricingPrice.Metadata.builder() + Price.ScalableMatrixWithTieredPricing.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.ScalableMatrixWithTieredPricingPrice.Minimum.builder() + Price.ScalableMatrixWithTieredPricing.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5566,16 +5395,15 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.ScalableMatrixWithTieredPricingPrice.PriceType.USAGE_PRICE) + .priceType(Price.ScalableMatrixWithTieredPricing.PriceType.USAGE_PRICE) .scalableMatrixWithTieredPricingConfig( - Price.ScalableMatrixWithTieredPricingPrice.ScalableMatrixWithTieredPricingConfig + Price.ScalableMatrixWithTieredPricing.ScalableMatrixWithTieredPricingConfig .builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.ScalableMatrixWithTieredPricingPrice.DimensionalPriceConfiguration - .builder() + Price.ScalableMatrixWithTieredPricing.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5585,7 +5413,7 @@ internal class PriceTest { val price = Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -5620,29 +5448,28 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofScalableMatrixWithTieredPricing( - Price.ScalableMatrixWithTieredPricingPrice.builder() + Price.ScalableMatrixWithTieredPricing.builder() .id("id") .billableMetric( - Price.ScalableMatrixWithTieredPricingPrice.BillableMetric.builder() + Price.ScalableMatrixWithTieredPricing.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.ScalableMatrixWithTieredPricingPrice.BillingCycleConfiguration - .builder() + Price.ScalableMatrixWithTieredPricing.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithTieredPricingPrice.BillingCycleConfiguration + Price.ScalableMatrixWithTieredPricing.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.ScalableMatrixWithTieredPricingPrice.Cadence.ONE_TIME) + .cadence(Price.ScalableMatrixWithTieredPricing.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.ScalableMatrixWithTieredPricingPrice.CreditAllocation.builder() + Price.ScalableMatrixWithTieredPricing.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -5660,37 +5487,35 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.ScalableMatrixWithTieredPricingPrice.InvoicingCycleConfiguration - .builder() + Price.ScalableMatrixWithTieredPricing.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.ScalableMatrixWithTieredPricingPrice - .InvoicingCycleConfiguration + Price.ScalableMatrixWithTieredPricing.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.ScalableMatrixWithTieredPricingPrice.Item.builder() + Price.ScalableMatrixWithTieredPricing.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.ScalableMatrixWithTieredPricingPrice.Maximum.builder() + Price.ScalableMatrixWithTieredPricing.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.ScalableMatrixWithTieredPricingPrice.Metadata.builder() + Price.ScalableMatrixWithTieredPricing.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.ScalableMatrixWithTieredPricingPrice.Minimum.builder() + Price.ScalableMatrixWithTieredPricing.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5698,16 +5523,15 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.ScalableMatrixWithTieredPricingPrice.PriceType.USAGE_PRICE) + .priceType(Price.ScalableMatrixWithTieredPricing.PriceType.USAGE_PRICE) .scalableMatrixWithTieredPricingConfig( - Price.ScalableMatrixWithTieredPricingPrice - .ScalableMatrixWithTieredPricingConfig + Price.ScalableMatrixWithTieredPricing.ScalableMatrixWithTieredPricingConfig .builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) .dimensionalPriceConfiguration( - Price.ScalableMatrixWithTieredPricingPrice.DimensionalPriceConfiguration + Price.ScalableMatrixWithTieredPricing.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") @@ -5725,31 +5549,30 @@ internal class PriceTest { @Test fun ofCumulativeGroupedBulk() { val cumulativeGroupedBulk = - Price.CumulativeGroupedBulkPrice.builder() + Price.CumulativeGroupedBulk.builder() .id("id") .billableMetric( - Price.CumulativeGroupedBulkPrice.BillableMetric.builder().id("id").build() + Price.CumulativeGroupedBulk.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.CumulativeGroupedBulkPrice.BillingCycleConfiguration.builder() + Price.CumulativeGroupedBulk.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.CumulativeGroupedBulkPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.CumulativeGroupedBulk.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.CumulativeGroupedBulkPrice.Cadence.ONE_TIME) + .cadence(Price.CumulativeGroupedBulk.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.CumulativeGroupedBulkPrice.CreditAllocation.builder() + Price.CumulativeGroupedBulk.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() ) .cumulativeGroupedBulkConfig( - Price.CumulativeGroupedBulkPrice.CumulativeGroupedBulkConfig.builder() + Price.CumulativeGroupedBulk.CumulativeGroupedBulkConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -5766,30 +5589,28 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.CumulativeGroupedBulkPrice.InvoicingCycleConfiguration.builder() + Price.CumulativeGroupedBulk.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.CumulativeGroupedBulkPrice.InvoicingCycleConfiguration - .DurationUnit - .DAY + Price.CumulativeGroupedBulk.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.CumulativeGroupedBulkPrice.Item.builder().id("id").name("name").build()) + .item(Price.CumulativeGroupedBulk.Item.builder().id("id").name("name").build()) .maximum( - Price.CumulativeGroupedBulkPrice.Maximum.builder() + Price.CumulativeGroupedBulk.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.CumulativeGroupedBulkPrice.Metadata.builder() + Price.CumulativeGroupedBulk.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.CumulativeGroupedBulkPrice.Minimum.builder() + Price.CumulativeGroupedBulk.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5797,9 +5618,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.CumulativeGroupedBulkPrice.PriceType.USAGE_PRICE) + .priceType(Price.CumulativeGroupedBulk.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.CumulativeGroupedBulkPrice.DimensionalPriceConfiguration.builder() + Price.CumulativeGroupedBulk.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -5809,7 +5630,7 @@ internal class PriceTest { val price = Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk) assertThat(price.unit()).isEmpty - assertThat(price.packagePrice()).isEmpty + assertThat(price.package_()).isEmpty assertThat(price.matrix()).isEmpty assertThat(price.tiered()).isEmpty assertThat(price.tieredBps()).isEmpty @@ -5843,32 +5664,31 @@ internal class PriceTest { val jsonMapper = jsonMapper() val price = Price.ofCumulativeGroupedBulk( - Price.CumulativeGroupedBulkPrice.builder() + Price.CumulativeGroupedBulk.builder() .id("id") .billableMetric( - Price.CumulativeGroupedBulkPrice.BillableMetric.builder().id("id").build() + Price.CumulativeGroupedBulk.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.CumulativeGroupedBulkPrice.BillingCycleConfiguration.builder() + Price.CumulativeGroupedBulk.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.CumulativeGroupedBulkPrice.BillingCycleConfiguration - .DurationUnit + Price.CumulativeGroupedBulk.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.CumulativeGroupedBulkPrice.Cadence.ONE_TIME) + .cadence(Price.CumulativeGroupedBulk.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.CumulativeGroupedBulkPrice.CreditAllocation.builder() + Price.CumulativeGroupedBulk.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() ) .cumulativeGroupedBulkConfig( - Price.CumulativeGroupedBulkPrice.CumulativeGroupedBulkConfig.builder() + Price.CumulativeGroupedBulk.CumulativeGroupedBulkConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -5885,35 +5705,29 @@ internal class PriceTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.CumulativeGroupedBulkPrice.InvoicingCycleConfiguration.builder() + Price.CumulativeGroupedBulk.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.CumulativeGroupedBulkPrice.InvoicingCycleConfiguration - .DurationUnit + Price.CumulativeGroupedBulk.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.CumulativeGroupedBulkPrice.Item.builder() - .id("id") - .name("name") - .build() - ) + .item(Price.CumulativeGroupedBulk.Item.builder().id("id").name("name").build()) .maximum( - Price.CumulativeGroupedBulkPrice.Maximum.builder() + Price.CumulativeGroupedBulk.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.CumulativeGroupedBulkPrice.Metadata.builder() + Price.CumulativeGroupedBulk.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.CumulativeGroupedBulkPrice.Minimum.builder() + Price.CumulativeGroupedBulk.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -5921,9 +5735,9 @@ internal class PriceTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.CumulativeGroupedBulkPrice.PriceType.USAGE_PRICE) + .priceType(Price.CumulativeGroupedBulk.PriceType.USAGE_PRICE) .dimensionalPriceConfiguration( - Price.CumulativeGroupedBulkPrice.DimensionalPriceConfiguration.builder() + Price.CumulativeGroupedBulk.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt index f8f0bd863..cc97d97b2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt @@ -21,8 +21,7 @@ internal class SubscriptionCancelResponseTest { SubscriptionCancelResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionCancelResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionCancelResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -137,7 +136,7 @@ internal class SubscriptionCancelResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionCancelResponse.DiscountInterval.AmountDiscountInterval.builder() + SubscriptionCancelResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -186,7 +185,7 @@ internal class SubscriptionCancelResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -273,25 +272,24 @@ internal class SubscriptionCancelResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -309,29 +307,28 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -339,14 +336,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -391,25 +388,24 @@ internal class SubscriptionCancelResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -427,29 +423,28 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -457,14 +452,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -682,9 +677,7 @@ internal class SubscriptionCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -726,32 +719,30 @@ internal class SubscriptionCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -772,32 +763,30 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -805,7 +794,7 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -813,14 +802,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -835,19 +824,17 @@ internal class SubscriptionCancelResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1115,9 +1102,7 @@ internal class SubscriptionCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1159,32 +1144,30 @@ internal class SubscriptionCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1205,32 +1188,30 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1238,7 +1219,7 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1246,14 +1227,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1268,19 +1249,17 @@ internal class SubscriptionCancelResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1368,8 +1347,7 @@ internal class SubscriptionCancelResponseTest { SubscriptionCancelResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionCancelResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionCancelResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1490,7 +1468,7 @@ internal class SubscriptionCancelResponseTest { assertThat(subscriptionCancelResponse.discountIntervals()) .containsExactly( SubscriptionCancelResponse.DiscountInterval.ofAmount( - SubscriptionCancelResponse.DiscountInterval.AmountDiscountInterval.builder() + SubscriptionCancelResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1547,7 +1525,7 @@ internal class SubscriptionCancelResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1634,24 +1612,22 @@ internal class SubscriptionCancelResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1669,28 +1645,28 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1698,14 +1674,12 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1747,24 +1721,22 @@ internal class SubscriptionCancelResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1782,28 +1754,28 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1811,14 +1783,12 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2032,8 +2002,7 @@ internal class SubscriptionCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2075,30 +2044,28 @@ internal class SubscriptionCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2118,31 +2085,30 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2150,7 +2116,7 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2158,15 +2124,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2178,19 +2143,17 @@ internal class SubscriptionCancelResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2447,8 +2410,7 @@ internal class SubscriptionCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2490,30 +2452,28 @@ internal class SubscriptionCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2533,31 +2493,30 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2565,7 +2524,7 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2573,15 +2532,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2593,19 +2551,17 @@ internal class SubscriptionCancelResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2695,8 +2651,7 @@ internal class SubscriptionCancelResponseTest { SubscriptionCancelResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionCancelResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionCancelResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2811,7 +2766,7 @@ internal class SubscriptionCancelResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionCancelResponse.DiscountInterval.AmountDiscountInterval.builder() + SubscriptionCancelResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2860,7 +2815,7 @@ internal class SubscriptionCancelResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2947,25 +2902,24 @@ internal class SubscriptionCancelResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2983,29 +2937,28 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3013,14 +2966,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3065,25 +3018,24 @@ internal class SubscriptionCancelResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3101,29 +3053,28 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3131,14 +3082,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3356,9 +3307,7 @@ internal class SubscriptionCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3400,32 +3349,30 @@ internal class SubscriptionCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3446,32 +3393,30 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3479,7 +3424,7 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3487,14 +3432,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3509,19 +3454,17 @@ internal class SubscriptionCancelResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3789,9 +3732,7 @@ internal class SubscriptionCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3833,32 +3774,30 @@ internal class SubscriptionCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3879,32 +3818,30 @@ internal class SubscriptionCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3912,7 +3849,7 @@ internal class SubscriptionCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3920,14 +3857,14 @@ internal class SubscriptionCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3942,19 +3879,17 @@ internal class SubscriptionCancelResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt index e97395969..68d268cd4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt @@ -29,7 +29,7 @@ internal class SubscriptionChangeApplyResponseTest { .adjustment( SubscriptionChangeApplyResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -151,8 +151,7 @@ internal class SubscriptionChangeApplyResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeApplyResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeApplyResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -206,7 +205,7 @@ internal class SubscriptionChangeApplyResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -295,28 +294,26 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -336,30 +333,27 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -367,7 +361,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -375,14 +369,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -432,28 +426,26 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -473,30 +465,27 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -504,7 +493,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -512,14 +501,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -763,8 +752,7 @@ internal class SubscriptionChangeApplyResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -812,27 +800,26 @@ internal class SubscriptionChangeApplyResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -840,8 +827,7 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -866,12 +852,11 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -879,20 +864,20 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -900,7 +885,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -908,17 +893,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -935,12 +917,10 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -948,8 +928,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -1257,8 +1236,7 @@ internal class SubscriptionChangeApplyResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -1306,27 +1284,26 @@ internal class SubscriptionChangeApplyResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -1334,8 +1311,7 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1360,12 +1336,11 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -1373,20 +1348,20 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1394,7 +1369,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1402,17 +1377,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1429,12 +1401,10 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -1442,8 +1412,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -1560,7 +1529,7 @@ internal class SubscriptionChangeApplyResponseTest { .adjustment( SubscriptionChangeApplyResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1677,8 +1646,7 @@ internal class SubscriptionChangeApplyResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeApplyResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeApplyResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -1732,7 +1700,7 @@ internal class SubscriptionChangeApplyResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1821,26 +1789,25 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1860,32 +1827,29 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1893,14 +1857,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1946,26 +1910,25 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1985,32 +1948,29 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2018,14 +1978,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2252,9 +2212,7 @@ internal class SubscriptionChangeApplyResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2298,26 +2256,25 @@ internal class SubscriptionChangeApplyResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -2325,7 +2282,7 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2346,11 +2303,11 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -2358,20 +2315,20 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2379,7 +2336,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2387,17 +2344,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -2412,21 +2366,17 @@ internal class SubscriptionChangeApplyResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -2714,9 +2664,7 @@ internal class SubscriptionChangeApplyResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2760,26 +2708,25 @@ internal class SubscriptionChangeApplyResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -2787,7 +2734,7 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2808,11 +2755,11 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -2820,20 +2767,20 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2841,7 +2788,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2849,17 +2796,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -2874,21 +2818,17 @@ internal class SubscriptionChangeApplyResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -3005,7 +2945,7 @@ internal class SubscriptionChangeApplyResponseTest { .adjustment( SubscriptionChangeApplyResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -3127,8 +3067,7 @@ internal class SubscriptionChangeApplyResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeApplyResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeApplyResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -3182,7 +3121,7 @@ internal class SubscriptionChangeApplyResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3271,28 +3210,26 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3312,30 +3249,27 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3343,7 +3277,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3351,14 +3285,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -3408,28 +3342,26 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3449,30 +3381,27 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3480,7 +3409,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3488,14 +3417,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -3739,8 +3668,7 @@ internal class SubscriptionChangeApplyResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -3788,27 +3716,26 @@ internal class SubscriptionChangeApplyResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -3816,8 +3743,7 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3842,12 +3768,11 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -3855,20 +3780,20 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3876,7 +3801,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3884,17 +3809,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3911,12 +3833,10 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -3924,8 +3844,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -4233,8 +4152,7 @@ internal class SubscriptionChangeApplyResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -4282,27 +4200,26 @@ internal class SubscriptionChangeApplyResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -4310,8 +4227,7 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4336,12 +4252,11 @@ internal class SubscriptionChangeApplyResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -4349,20 +4264,20 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -4370,7 +4285,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4378,17 +4293,14 @@ internal class SubscriptionChangeApplyResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -4405,12 +4317,10 @@ internal class SubscriptionChangeApplyResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -4418,8 +4328,7 @@ internal class SubscriptionChangeApplyResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt index b4ff77259..4836f2928 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt @@ -29,7 +29,7 @@ internal class SubscriptionChangeCancelResponseTest { .adjustment( SubscriptionChangeCancelResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -151,8 +151,7 @@ internal class SubscriptionChangeCancelResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeCancelResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeCancelResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -206,7 +205,7 @@ internal class SubscriptionChangeCancelResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -295,28 +294,26 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -336,30 +333,27 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -367,7 +361,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -375,14 +369,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -432,28 +426,26 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -473,30 +465,27 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -504,7 +493,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -512,14 +501,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -763,8 +752,7 @@ internal class SubscriptionChangeCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -812,27 +800,26 @@ internal class SubscriptionChangeCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -840,8 +827,7 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -866,12 +852,11 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -879,20 +864,20 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -900,7 +885,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -908,17 +893,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -935,12 +917,10 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -948,8 +928,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -1257,8 +1236,7 @@ internal class SubscriptionChangeCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -1306,27 +1284,26 @@ internal class SubscriptionChangeCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -1334,8 +1311,7 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1360,12 +1336,11 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -1373,20 +1348,20 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1394,7 +1369,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1402,17 +1377,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1429,12 +1401,10 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -1442,8 +1412,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -1560,7 +1529,7 @@ internal class SubscriptionChangeCancelResponseTest { .adjustment( SubscriptionChangeCancelResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1678,8 +1647,7 @@ internal class SubscriptionChangeCancelResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeCancelResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeCancelResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -1733,7 +1701,7 @@ internal class SubscriptionChangeCancelResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1822,26 +1790,25 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1861,32 +1828,29 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1894,14 +1858,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1947,26 +1911,25 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1986,32 +1949,29 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2019,14 +1979,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2253,9 +2213,7 @@ internal class SubscriptionChangeCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2299,26 +2257,25 @@ internal class SubscriptionChangeCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -2326,7 +2283,7 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2347,11 +2304,11 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -2359,20 +2316,20 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2380,7 +2337,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2388,17 +2345,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -2413,21 +2367,17 @@ internal class SubscriptionChangeCancelResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -2715,9 +2665,7 @@ internal class SubscriptionChangeCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2761,26 +2709,25 @@ internal class SubscriptionChangeCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -2788,7 +2735,7 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2809,11 +2756,11 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -2821,20 +2768,20 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2842,7 +2789,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2850,17 +2797,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -2875,21 +2819,17 @@ internal class SubscriptionChangeCancelResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -3006,7 +2946,7 @@ internal class SubscriptionChangeCancelResponseTest { .adjustment( SubscriptionChangeCancelResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -3128,8 +3068,7 @@ internal class SubscriptionChangeCancelResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeCancelResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeCancelResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -3183,7 +3122,7 @@ internal class SubscriptionChangeCancelResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3272,28 +3211,26 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3313,30 +3250,27 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3344,7 +3278,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3352,14 +3286,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -3409,28 +3343,26 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3450,30 +3382,27 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3481,7 +3410,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3489,14 +3418,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -3740,8 +3669,7 @@ internal class SubscriptionChangeCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -3789,27 +3717,26 @@ internal class SubscriptionChangeCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -3817,8 +3744,7 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3843,12 +3769,11 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -3856,20 +3781,20 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3877,7 +3802,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3885,17 +3810,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3912,12 +3834,10 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -3925,8 +3845,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -4234,8 +4153,7 @@ internal class SubscriptionChangeCancelResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -4283,27 +4201,26 @@ internal class SubscriptionChangeCancelResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -4311,8 +4228,7 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4337,12 +4253,11 @@ internal class SubscriptionChangeCancelResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -4350,20 +4265,20 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -4371,7 +4286,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4379,17 +4294,14 @@ internal class SubscriptionChangeCancelResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -4406,12 +4318,10 @@ internal class SubscriptionChangeCancelResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -4419,8 +4329,7 @@ internal class SubscriptionChangeCancelResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt index be8d5ee89..5f8c766d7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt @@ -30,7 +30,7 @@ internal class SubscriptionChangeRetrieveResponseTest { SubscriptionChangeRetrieveResponse.Subscription .AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -152,8 +152,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -210,7 +209,7 @@ internal class SubscriptionChangeRetrieveResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -299,28 +298,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -340,30 +337,27 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -371,7 +365,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -379,14 +373,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -436,28 +430,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -477,30 +469,27 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -508,7 +497,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -516,14 +505,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -768,8 +757,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -817,27 +805,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -845,8 +832,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -871,12 +857,11 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -884,20 +869,20 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -905,7 +890,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -913,17 +898,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -940,12 +922,10 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -953,8 +933,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -1262,8 +1241,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -1311,27 +1289,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -1339,8 +1316,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1365,12 +1341,11 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -1378,20 +1353,20 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1399,7 +1374,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1407,17 +1382,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1434,12 +1406,10 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -1447,8 +1417,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -1565,7 +1534,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .adjustment( SubscriptionChangeRetrieveResponse.Subscription.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1683,8 +1652,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -1738,7 +1706,7 @@ internal class SubscriptionChangeRetrieveResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1827,26 +1795,25 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1866,32 +1833,29 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1899,14 +1863,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1952,26 +1916,25 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1991,32 +1954,29 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2024,14 +1984,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2258,9 +2218,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2304,26 +2262,25 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -2331,7 +2288,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2352,11 +2309,11 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -2364,20 +2321,20 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2385,7 +2342,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2393,17 +2350,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -2418,21 +2372,17 @@ internal class SubscriptionChangeRetrieveResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -2720,9 +2670,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2766,26 +2714,25 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -2793,7 +2740,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2814,11 +2761,11 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -2826,20 +2773,20 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2847,7 +2794,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2855,17 +2802,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -2880,21 +2824,17 @@ internal class SubscriptionChangeRetrieveResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -3012,7 +2952,7 @@ internal class SubscriptionChangeRetrieveResponseTest { SubscriptionChangeRetrieveResponse.Subscription .AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -3134,8 +3074,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval - .AmountDiscountInterval + SubscriptionChangeRetrieveResponse.Subscription.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -3192,7 +3131,7 @@ internal class SubscriptionChangeRetrieveResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -3281,28 +3220,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3322,30 +3259,27 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3353,7 +3287,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3361,14 +3295,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -3418,28 +3352,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3459,30 +3391,27 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3490,7 +3419,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3498,14 +3427,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -3750,8 +3679,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -3799,27 +3727,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -3827,8 +3754,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3853,12 +3779,11 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -3866,20 +3791,20 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3887,7 +3812,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3895,17 +3820,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3922,12 +3844,10 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -3935,8 +3855,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") @@ -4244,8 +4163,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment + Invoice.LineItem.Adjustment.UsageDiscount .builder() .id("id") .amount("amount") @@ -4293,27 +4211,26 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse( @@ -4321,8 +4238,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .creditAllocation( - Price.UnitPrice.CreditAllocation - .builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -4347,12 +4263,11 @@ internal class SubscriptionChangeRetrieveResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - Price.UnitPrice + Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -4360,20 +4275,20 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -4381,7 +4296,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -4389,17 +4304,14 @@ internal class SubscriptionChangeRetrieveResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType( - Price.UnitPrice.PriceType.USAGE_PRICE - ) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice - .DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -4416,12 +4328,10 @@ internal class SubscriptionChangeRetrieveResponseTest { ) ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .Grouping .builder() .key("region") @@ -4429,8 +4339,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem - .MatrixSubLineItem + Invoice.LineItem.SubLineItem.Matrix .MatrixConfig .builder() .addDimensionValue("string") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt index 6cb974090..c6e5a87a3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt @@ -16,7 +16,7 @@ internal class SubscriptionCreateParamsTest { .addAddAdjustment( SubscriptionCreateParams.AddAdjustment.builder() .adjustment( - SubscriptionCreateParams.AddAdjustment.Adjustment.NewPercentageDiscount + SubscriptionCreateParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -57,31 +57,24 @@ internal class SubscriptionCreateParamsTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice.builder() - .cadence( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .Cadence - .ANNUAL - ) + SubscriptionCreateParams.AddPrice.Price.Unit.builder() + .cadence(SubscriptionCreateParams.AddPrice.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .UnitConfig - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -94,13 +87,12 @@ internal class SubscriptionCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -108,9 +100,7 @@ internal class SubscriptionCreateParamsTest { .build() ) .metadata( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .Metadata - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -167,7 +157,7 @@ internal class SubscriptionCreateParamsTest { .addReplaceAdjustment( SubscriptionCreateParams.ReplaceAdjustment.builder() .adjustment( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment.NewPercentageDiscount + SubscriptionCreateParams.ReplaceAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -208,18 +198,14 @@ internal class SubscriptionCreateParamsTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .Cadence - .ANNUAL + SubscriptionCreateParams.ReplacePrice.Price.Unit.Cadence.ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.ReplacePrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -227,13 +213,12 @@ internal class SubscriptionCreateParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -246,13 +231,12 @@ internal class SubscriptionCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -260,9 +244,7 @@ internal class SubscriptionCreateParamsTest { .build() ) .metadata( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .Metadata - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -285,7 +267,7 @@ internal class SubscriptionCreateParamsTest { .addAddAdjustment( SubscriptionCreateParams.AddAdjustment.builder() .adjustment( - SubscriptionCreateParams.AddAdjustment.Adjustment.NewPercentageDiscount + SubscriptionCreateParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -328,18 +310,14 @@ internal class SubscriptionCreateParamsTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .Cadence - .ANNUAL + SubscriptionCreateParams.AddPrice.Price.Unit.Cadence.ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.AddPrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -347,13 +325,12 @@ internal class SubscriptionCreateParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -366,13 +343,12 @@ internal class SubscriptionCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -380,9 +356,7 @@ internal class SubscriptionCreateParamsTest { .build() ) .metadata( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .Metadata - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -439,8 +413,7 @@ internal class SubscriptionCreateParamsTest { .addReplaceAdjustment( SubscriptionCreateParams.ReplaceAdjustment.builder() .adjustment( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + SubscriptionCreateParams.ReplaceAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -481,20 +454,14 @@ internal class SubscriptionCreateParamsTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Cadence - .ANNUAL + SubscriptionCreateParams.ReplacePrice.Price.Unit.Cadence.ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.ReplacePrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -502,14 +469,12 @@ internal class SubscriptionCreateParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -522,14 +487,12 @@ internal class SubscriptionCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -537,9 +500,7 @@ internal class SubscriptionCreateParamsTest { .build() ) .metadata( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionCreateParams.ReplacePrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -561,7 +522,7 @@ internal class SubscriptionCreateParamsTest { .containsExactly( SubscriptionCreateParams.AddAdjustment.builder() .adjustment( - SubscriptionCreateParams.AddAdjustment.Adjustment.NewPercentageDiscount + SubscriptionCreateParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -603,31 +564,24 @@ internal class SubscriptionCreateParamsTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice.builder() - .cadence( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .Cadence - .ANNUAL - ) + SubscriptionCreateParams.AddPrice.Price.Unit.builder() + .cadence(SubscriptionCreateParams.AddPrice.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .UnitConfig - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -640,13 +594,12 @@ internal class SubscriptionCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -654,9 +607,7 @@ internal class SubscriptionCreateParamsTest { .build() ) .metadata( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .Metadata - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -721,7 +672,7 @@ internal class SubscriptionCreateParamsTest { .containsExactly( SubscriptionCreateParams.ReplaceAdjustment.builder() .adjustment( - SubscriptionCreateParams.ReplaceAdjustment.Adjustment.NewPercentageDiscount + SubscriptionCreateParams.ReplaceAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -763,18 +714,14 @@ internal class SubscriptionCreateParamsTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .Cadence - .ANNUAL + SubscriptionCreateParams.ReplacePrice.Price.Unit.Cadence.ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.ReplacePrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -782,13 +729,12 @@ internal class SubscriptionCreateParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -801,13 +747,12 @@ internal class SubscriptionCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -815,9 +760,7 @@ internal class SubscriptionCreateParamsTest { .build() ) .metadata( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .Metadata - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt index 3c7563684..4e9818f55 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt @@ -21,8 +21,7 @@ internal class SubscriptionCreateResponseTest { SubscriptionCreateResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionCreateResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionCreateResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -137,7 +136,7 @@ internal class SubscriptionCreateResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionCreateResponse.DiscountInterval.AmountDiscountInterval.builder() + SubscriptionCreateResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -186,7 +185,7 @@ internal class SubscriptionCreateResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -273,25 +272,24 @@ internal class SubscriptionCreateResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -309,29 +307,28 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -339,14 +336,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -391,25 +388,24 @@ internal class SubscriptionCreateResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -427,29 +423,28 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -457,14 +452,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -682,9 +677,7 @@ internal class SubscriptionCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -726,32 +719,30 @@ internal class SubscriptionCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -772,32 +763,30 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -805,7 +794,7 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -813,14 +802,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -835,19 +824,17 @@ internal class SubscriptionCreateResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1115,9 +1102,7 @@ internal class SubscriptionCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1159,32 +1144,30 @@ internal class SubscriptionCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1205,32 +1188,30 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1238,7 +1219,7 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1246,14 +1227,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1268,19 +1249,17 @@ internal class SubscriptionCreateResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1368,8 +1347,7 @@ internal class SubscriptionCreateResponseTest { SubscriptionCreateResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionCreateResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionCreateResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1490,7 +1468,7 @@ internal class SubscriptionCreateResponseTest { assertThat(subscriptionCreateResponse.discountIntervals()) .containsExactly( SubscriptionCreateResponse.DiscountInterval.ofAmount( - SubscriptionCreateResponse.DiscountInterval.AmountDiscountInterval.builder() + SubscriptionCreateResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1547,7 +1525,7 @@ internal class SubscriptionCreateResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1634,24 +1612,22 @@ internal class SubscriptionCreateResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1669,28 +1645,28 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1698,14 +1674,12 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1747,24 +1721,22 @@ internal class SubscriptionCreateResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1782,28 +1754,28 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1811,14 +1783,12 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2032,8 +2002,7 @@ internal class SubscriptionCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2075,30 +2044,28 @@ internal class SubscriptionCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2118,31 +2085,30 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2150,7 +2116,7 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2158,15 +2124,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2178,19 +2143,17 @@ internal class SubscriptionCreateResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2447,8 +2410,7 @@ internal class SubscriptionCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2490,30 +2452,28 @@ internal class SubscriptionCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2533,31 +2493,30 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2565,7 +2524,7 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2573,15 +2532,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2593,19 +2551,17 @@ internal class SubscriptionCreateResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2695,8 +2651,7 @@ internal class SubscriptionCreateResponseTest { SubscriptionCreateResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionCreateResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionCreateResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2811,7 +2766,7 @@ internal class SubscriptionCreateResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionCreateResponse.DiscountInterval.AmountDiscountInterval.builder() + SubscriptionCreateResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2860,7 +2815,7 @@ internal class SubscriptionCreateResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2947,25 +2902,24 @@ internal class SubscriptionCreateResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2983,29 +2937,28 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3013,14 +2966,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3065,25 +3018,24 @@ internal class SubscriptionCreateResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3101,29 +3053,28 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3131,14 +3082,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3356,9 +3307,7 @@ internal class SubscriptionCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3400,32 +3349,30 @@ internal class SubscriptionCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3446,32 +3393,30 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3479,7 +3424,7 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3487,14 +3432,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3509,19 +3454,17 @@ internal class SubscriptionCreateResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3789,9 +3732,7 @@ internal class SubscriptionCreateResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3833,32 +3774,30 @@ internal class SubscriptionCreateResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3879,32 +3818,30 @@ internal class SubscriptionCreateResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3912,7 +3849,7 @@ internal class SubscriptionCreateResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3920,14 +3857,14 @@ internal class SubscriptionCreateResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3942,19 +3879,17 @@ internal class SubscriptionCreateResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt index 413f38a85..9be91a3bf 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt @@ -20,28 +20,26 @@ internal class SubscriptionFetchCostsResponseTest { .addPerPriceCost( SubscriptionFetchCostsResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -61,30 +59,27 @@ internal class SubscriptionFetchCostsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -92,7 +87,7 @@ internal class SubscriptionFetchCostsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -100,14 +95,14 @@ internal class SubscriptionFetchCostsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -136,26 +131,25 @@ internal class SubscriptionFetchCostsResponseTest { .addPerPriceCost( SubscriptionFetchCostsResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -175,32 +169,29 @@ internal class SubscriptionFetchCostsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -208,14 +199,14 @@ internal class SubscriptionFetchCostsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -246,28 +237,26 @@ internal class SubscriptionFetchCostsResponseTest { .addPerPriceCost( SubscriptionFetchCostsResponse.Data.PerPriceCost.builder() .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -287,30 +276,27 @@ internal class SubscriptionFetchCostsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -318,7 +304,7 @@ internal class SubscriptionFetchCostsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -326,14 +312,14 @@ internal class SubscriptionFetchCostsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt index f6430d002..54ca0abb4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt @@ -27,7 +27,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .expiresAtEndOfCadence(true) .build() ) - .addAmountDiscountCreationParamsDiscount(0.0) + .addAmountDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") .filter("my_property > 100 AND my_other_property = 'bar'") @@ -40,32 +40,25 @@ internal class SubscriptionPriceIntervalsParamsTest { .maximumAmount(0.0) .minimumAmount(0.0) .price( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice.builder() - .cadence( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .Cadence - .ANNUAL - ) + SubscriptionPriceIntervalsParams.Add.Price.Unit.builder() + .cadence(SubscriptionPriceIntervalsParams.Add.Price.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .UnitConfig - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -77,13 +70,12 @@ internal class SubscriptionPriceIntervalsParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -91,9 +83,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .build() ) .metadata( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .Metadata - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -106,8 +96,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .addAddAdjustment( SubscriptionPriceIntervalsParams.AddAdjustment.builder() .adjustment( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount + SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -175,7 +164,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .expiresAtEndOfCadence(true) .build() ) - .addAmountDiscountCreationParamsDiscount(0.0) + .addAmountDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") .filter("my_property > 100 AND my_other_property = 'bar'") @@ -189,19 +178,15 @@ internal class SubscriptionPriceIntervalsParamsTest { .maximumAmount(0.0) .minimumAmount(0.0) .price( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.builder() .cadence( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .Cadence - .ANNUAL + SubscriptionPriceIntervalsParams.Add.Price.Unit.Cadence.ANNUAL ) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .UnitConfig + SubscriptionPriceIntervalsParams.Add.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -209,13 +194,12 @@ internal class SubscriptionPriceIntervalsParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -227,13 +211,12 @@ internal class SubscriptionPriceIntervalsParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -241,8 +224,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .build() ) .metadata( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .Metadata + SubscriptionPriceIntervalsParams.Add.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -257,7 +239,7 @@ internal class SubscriptionPriceIntervalsParamsTest { SubscriptionPriceIntervalsParams.AddAdjustment.builder() .adjustment( SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -312,7 +294,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .expiresAtEndOfCadence(true) .build() ) - .addAmountDiscountCreationParamsDiscount(0.0) + .addAmountDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") .filter("my_property > 100 AND my_other_property = 'bar'") @@ -325,32 +307,25 @@ internal class SubscriptionPriceIntervalsParamsTest { .maximumAmount(0.0) .minimumAmount(0.0) .price( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice.builder() - .cadence( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .Cadence - .ANNUAL - ) + SubscriptionPriceIntervalsParams.Add.Price.Unit.builder() + .cadence(SubscriptionPriceIntervalsParams.Add.Price.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .UnitConfig - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -362,13 +337,12 @@ internal class SubscriptionPriceIntervalsParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -376,9 +350,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .build() ) .metadata( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .Metadata - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -392,8 +364,7 @@ internal class SubscriptionPriceIntervalsParamsTest { .containsExactly( SubscriptionPriceIntervalsParams.AddAdjustment.builder() .adjustment( - SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount + SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt index e17403f04..f6ed93057 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt @@ -22,7 +22,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustment( SubscriptionPriceIntervalsResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -137,8 +137,7 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionPriceIntervalsResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionPriceIntervalsResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -189,7 +188,7 @@ internal class SubscriptionPriceIntervalsResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -276,25 +275,24 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -312,29 +310,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -342,14 +339,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -395,25 +392,24 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -431,29 +427,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -461,14 +456,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -686,9 +681,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -730,32 +723,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -776,32 +767,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -809,7 +798,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -817,14 +806,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -839,19 +828,17 @@ internal class SubscriptionPriceIntervalsResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1119,9 +1106,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1163,32 +1148,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1209,32 +1192,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1242,7 +1223,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1250,14 +1231,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1272,19 +1253,17 @@ internal class SubscriptionPriceIntervalsResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1373,7 +1352,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustment( SubscriptionPriceIntervalsResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1495,8 +1474,7 @@ internal class SubscriptionPriceIntervalsResponseTest { assertThat(subscriptionPriceIntervalsResponse.discountIntervals()) .containsExactly( SubscriptionPriceIntervalsResponse.DiscountInterval.ofAmount( - SubscriptionPriceIntervalsResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionPriceIntervalsResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1556,7 +1534,7 @@ internal class SubscriptionPriceIntervalsResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1643,24 +1621,22 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1678,28 +1654,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1707,14 +1683,12 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1756,24 +1730,22 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1791,28 +1763,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1820,14 +1792,12 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2041,8 +2011,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2084,30 +2053,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2127,31 +2094,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2159,7 +2125,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2167,15 +2133,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2187,19 +2152,17 @@ internal class SubscriptionPriceIntervalsResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2456,8 +2419,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2499,30 +2461,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2542,31 +2502,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2574,7 +2533,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2582,15 +2541,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2602,19 +2560,17 @@ internal class SubscriptionPriceIntervalsResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2705,7 +2661,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustment( SubscriptionPriceIntervalsResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2820,8 +2776,7 @@ internal class SubscriptionPriceIntervalsResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionPriceIntervalsResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionPriceIntervalsResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2872,7 +2827,7 @@ internal class SubscriptionPriceIntervalsResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2959,25 +2914,24 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2995,29 +2949,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3025,14 +2978,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3078,25 +3031,24 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3114,29 +3066,28 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3144,14 +3095,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3369,9 +3320,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3413,32 +3362,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3459,32 +3406,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3492,7 +3437,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3500,14 +3445,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3522,19 +3467,17 @@ internal class SubscriptionPriceIntervalsResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3802,9 +3745,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3846,32 +3787,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3892,32 +3831,30 @@ internal class SubscriptionPriceIntervalsResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3925,7 +3862,7 @@ internal class SubscriptionPriceIntervalsResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3933,14 +3870,14 @@ internal class SubscriptionPriceIntervalsResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3955,19 +3892,17 @@ internal class SubscriptionPriceIntervalsResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt index 5af625122..5f9971e97 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt @@ -19,7 +19,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -63,20 +63,15 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionSchedulePlanChangeParams.AddPrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -84,14 +79,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -104,14 +97,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -119,9 +110,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -173,7 +162,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -216,20 +205,15 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -238,14 +222,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -258,14 +240,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -273,8 +253,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -314,7 +293,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -359,20 +338,15 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -381,14 +355,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -401,14 +373,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -416,8 +386,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -470,7 +439,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -515,20 +484,16 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -537,14 +502,13 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + .Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -557,14 +521,13 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + .Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -572,8 +535,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -598,7 +560,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -643,20 +605,15 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionSchedulePlanChangeParams.AddPrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -664,14 +621,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -684,14 +639,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -699,9 +652,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -757,7 +708,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -801,20 +752,15 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -823,14 +769,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -843,14 +787,12 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -858,8 +800,7 @@ internal class SubscriptionSchedulePlanChangeParamsTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt index e24f9b864..0d167d702 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt @@ -22,7 +22,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustment( SubscriptionSchedulePlanChangeResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -137,8 +137,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionSchedulePlanChangeResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionSchedulePlanChangeResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -189,7 +188,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -276,25 +275,24 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -312,29 +310,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -342,14 +339,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -395,25 +392,24 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -431,29 +427,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -461,14 +456,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -686,9 +681,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -730,32 +723,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -776,32 +767,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -809,7 +798,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -817,14 +806,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -839,19 +828,17 @@ internal class SubscriptionSchedulePlanChangeResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1119,9 +1106,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1163,32 +1148,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1209,32 +1192,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1242,7 +1223,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1250,14 +1231,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1272,19 +1253,17 @@ internal class SubscriptionSchedulePlanChangeResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1373,7 +1352,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustment( SubscriptionSchedulePlanChangeResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1495,8 +1474,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { assertThat(subscriptionSchedulePlanChangeResponse.discountIntervals()) .containsExactly( SubscriptionSchedulePlanChangeResponse.DiscountInterval.ofAmount( - SubscriptionSchedulePlanChangeResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionSchedulePlanChangeResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1556,7 +1534,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1643,24 +1621,22 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1678,28 +1654,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1707,14 +1683,12 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1757,24 +1731,22 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1792,28 +1764,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1821,14 +1793,12 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2042,8 +2012,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2085,30 +2054,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2128,31 +2095,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2160,7 +2126,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2168,15 +2134,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2188,19 +2153,17 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2457,8 +2420,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2500,30 +2462,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2543,31 +2503,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2575,7 +2534,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2583,15 +2542,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2603,19 +2561,17 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2706,7 +2662,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustment( SubscriptionSchedulePlanChangeResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2821,8 +2777,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionSchedulePlanChangeResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionSchedulePlanChangeResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2873,7 +2828,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2960,25 +2915,24 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2996,29 +2950,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3026,14 +2979,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3079,25 +3032,24 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3115,29 +3067,28 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3145,14 +3096,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3370,9 +3321,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3414,32 +3363,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3460,32 +3407,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3493,7 +3438,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3501,14 +3446,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3523,19 +3468,17 @@ internal class SubscriptionSchedulePlanChangeResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3803,9 +3746,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3847,32 +3788,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3893,32 +3832,30 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3926,7 +3863,7 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3934,14 +3871,14 @@ internal class SubscriptionSchedulePlanChangeResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3956,19 +3893,17 @@ internal class SubscriptionSchedulePlanChangeResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt index 5db50c37d..20ab4d9f7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt @@ -21,9 +21,7 @@ internal class SubscriptionTest { Subscription.AdjustmentInterval.builder() .id("id") .adjustment( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .builder() + Subscription.AdjustmentInterval.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -137,7 +135,7 @@ internal class SubscriptionTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - Subscription.DiscountInterval.AmountDiscountInterval.builder() + Subscription.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -186,7 +184,7 @@ internal class SubscriptionTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -273,25 +271,24 @@ internal class SubscriptionTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -309,29 +306,28 @@ internal class SubscriptionTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -339,14 +335,14 @@ internal class SubscriptionTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -390,25 +386,24 @@ internal class SubscriptionTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -426,29 +421,28 @@ internal class SubscriptionTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -456,14 +450,14 @@ internal class SubscriptionTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -497,8 +491,7 @@ internal class SubscriptionTest { Subscription.AdjustmentInterval.builder() .id("id") .adjustment( - Subscription.AdjustmentInterval.Adjustment.PlanPhaseUsageDiscountAdjustment - .builder() + Subscription.AdjustmentInterval.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -618,7 +611,7 @@ internal class SubscriptionTest { assertThat(subscription.discountIntervals()) .containsExactly( Subscription.DiscountInterval.ofAmount( - Subscription.DiscountInterval.AmountDiscountInterval.builder() + Subscription.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -673,7 +666,7 @@ internal class SubscriptionTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -760,24 +753,22 @@ internal class SubscriptionTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -795,28 +786,28 @@ internal class SubscriptionTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -824,14 +815,12 @@ internal class SubscriptionTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -872,24 +861,22 @@ internal class SubscriptionTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -907,28 +894,28 @@ internal class SubscriptionTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -936,14 +923,12 @@ internal class SubscriptionTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -984,9 +969,7 @@ internal class SubscriptionTest { Subscription.AdjustmentInterval.builder() .id("id") .adjustment( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .builder() + Subscription.AdjustmentInterval.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1100,7 +1083,7 @@ internal class SubscriptionTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - Subscription.DiscountInterval.AmountDiscountInterval.builder() + Subscription.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1149,7 +1132,7 @@ internal class SubscriptionTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1236,25 +1219,24 @@ internal class SubscriptionTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1272,29 +1254,28 @@ internal class SubscriptionTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1302,14 +1283,14 @@ internal class SubscriptionTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1353,25 +1334,24 @@ internal class SubscriptionTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1389,29 +1369,28 @@ internal class SubscriptionTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1419,14 +1398,14 @@ internal class SubscriptionTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt index 6eee7cfed..e4e557d70 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt @@ -22,7 +22,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustment( SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -137,8 +137,7 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionTriggerPhaseResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionTriggerPhaseResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -189,7 +188,7 @@ internal class SubscriptionTriggerPhaseResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -276,25 +275,24 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -312,29 +310,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -342,14 +339,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -395,25 +392,24 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -431,29 +427,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -461,14 +456,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -686,9 +681,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -730,32 +723,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -776,32 +767,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -809,7 +798,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -817,14 +806,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -839,19 +828,17 @@ internal class SubscriptionTriggerPhaseResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1119,9 +1106,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1163,32 +1148,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1209,32 +1192,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1242,7 +1223,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1250,14 +1231,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1272,19 +1253,17 @@ internal class SubscriptionTriggerPhaseResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1372,8 +1351,7 @@ internal class SubscriptionTriggerPhaseResponseTest { SubscriptionTriggerPhaseResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1495,8 +1473,7 @@ internal class SubscriptionTriggerPhaseResponseTest { assertThat(subscriptionTriggerPhaseResponse.discountIntervals()) .containsExactly( SubscriptionTriggerPhaseResponse.DiscountInterval.ofAmount( - SubscriptionTriggerPhaseResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionTriggerPhaseResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1556,7 +1533,7 @@ internal class SubscriptionTriggerPhaseResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1643,24 +1620,22 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1678,28 +1653,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1707,14 +1682,12 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1756,24 +1729,22 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1791,28 +1762,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1820,14 +1791,12 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2041,8 +2010,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2084,30 +2052,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2127,31 +2093,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2159,7 +2124,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2167,15 +2132,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2187,19 +2151,17 @@ internal class SubscriptionTriggerPhaseResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2456,8 +2418,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2499,30 +2460,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2542,31 +2501,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2574,7 +2532,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2582,15 +2540,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2602,19 +2559,17 @@ internal class SubscriptionTriggerPhaseResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2705,7 +2660,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustment( SubscriptionTriggerPhaseResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2820,8 +2775,7 @@ internal class SubscriptionTriggerPhaseResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionTriggerPhaseResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionTriggerPhaseResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2872,7 +2826,7 @@ internal class SubscriptionTriggerPhaseResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2959,25 +2913,24 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2995,29 +2948,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3025,14 +2977,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3078,25 +3030,24 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3114,29 +3065,28 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3144,14 +3094,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3369,9 +3319,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3413,32 +3361,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3459,32 +3405,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3492,7 +3436,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3500,14 +3444,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3522,19 +3466,17 @@ internal class SubscriptionTriggerPhaseResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3802,9 +3744,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3846,32 +3786,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3892,32 +3830,30 @@ internal class SubscriptionTriggerPhaseResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3925,7 +3861,7 @@ internal class SubscriptionTriggerPhaseResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3933,14 +3869,14 @@ internal class SubscriptionTriggerPhaseResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3955,19 +3891,17 @@ internal class SubscriptionTriggerPhaseResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt index 5061da066..d49882f79 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt @@ -22,7 +22,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustment( SubscriptionUnscheduleCancellationResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -138,9 +138,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUnscheduleCancellationResponse.DiscountInterval - .AmountDiscountInterval - .builder() + SubscriptionUnscheduleCancellationResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -191,7 +189,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -278,25 +276,24 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -314,29 +311,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -344,14 +340,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -397,25 +393,24 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -433,29 +428,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -463,14 +457,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -688,9 +682,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -732,32 +724,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -778,32 +768,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -811,7 +799,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -819,14 +807,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -841,19 +829,17 @@ internal class SubscriptionUnscheduleCancellationResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1121,9 +1107,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1165,32 +1149,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1211,32 +1193,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1244,7 +1224,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1252,14 +1232,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1274,19 +1254,17 @@ internal class SubscriptionUnscheduleCancellationResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1375,7 +1353,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustment( SubscriptionUnscheduleCancellationResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1497,9 +1475,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { assertThat(subscriptionUnscheduleCancellationResponse.discountIntervals()) .containsExactly( SubscriptionUnscheduleCancellationResponse.DiscountInterval.ofAmount( - SubscriptionUnscheduleCancellationResponse.DiscountInterval - .AmountDiscountInterval - .builder() + SubscriptionUnscheduleCancellationResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1559,7 +1535,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1646,24 +1622,22 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1681,28 +1655,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1710,14 +1684,12 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1760,24 +1732,22 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1795,28 +1765,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1824,14 +1794,12 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2045,8 +2013,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2088,30 +2055,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2131,31 +2096,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2163,7 +2127,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2171,15 +2135,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2191,19 +2154,17 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2460,8 +2421,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2503,30 +2463,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2546,31 +2504,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2578,7 +2535,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2586,15 +2543,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2606,19 +2562,17 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2709,7 +2663,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustment( SubscriptionUnscheduleCancellationResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2825,9 +2779,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUnscheduleCancellationResponse.DiscountInterval - .AmountDiscountInterval - .builder() + SubscriptionUnscheduleCancellationResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2878,7 +2830,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2965,25 +2917,24 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3001,29 +2952,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3031,14 +2981,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3084,25 +3034,24 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3120,29 +3069,28 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3150,14 +3098,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3375,9 +3323,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3419,32 +3365,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3465,32 +3409,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3498,7 +3440,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3506,14 +3448,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3528,19 +3470,17 @@ internal class SubscriptionUnscheduleCancellationResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3808,9 +3748,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3852,32 +3790,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3898,32 +3834,30 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3931,7 +3865,7 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3939,14 +3873,14 @@ internal class SubscriptionUnscheduleCancellationResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3961,19 +3895,17 @@ internal class SubscriptionUnscheduleCancellationResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt index eeeba5c7b..6554731d8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt @@ -24,7 +24,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .adjustment( SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -141,8 +141,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval - .AmountDiscountInterval + SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -196,7 +195,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -283,25 +282,24 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -319,29 +317,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -349,14 +346,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -402,25 +399,24 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -438,29 +434,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -468,14 +463,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -693,9 +688,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -737,32 +730,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -783,32 +774,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -816,7 +805,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -824,14 +813,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -846,19 +835,17 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1126,9 +1113,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1170,32 +1155,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1216,32 +1199,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1249,7 +1230,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1257,14 +1238,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1279,19 +1260,17 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1382,7 +1361,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .adjustment( SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1516,8 +1495,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { assertThat(subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.discountIntervals()) .containsExactly( SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval.ofAmount( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval - .AmountDiscountInterval + SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -1582,7 +1560,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1669,24 +1647,22 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1704,28 +1680,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1733,14 +1709,12 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1783,24 +1757,22 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1818,28 +1790,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1847,14 +1819,12 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2068,8 +2038,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2111,30 +2080,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2154,31 +2121,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2186,7 +2152,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2194,15 +2160,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2214,19 +2179,17 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2483,8 +2446,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2526,30 +2488,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2569,31 +2529,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2601,7 +2560,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2609,15 +2568,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2629,19 +2587,17 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2734,7 +2690,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .adjustment( SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2851,8 +2807,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval - .AmountDiscountInterval + SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -2906,7 +2861,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2993,25 +2948,24 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3029,29 +2983,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3059,14 +3012,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3112,25 +3065,24 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3148,29 +3100,28 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3178,14 +3129,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3403,9 +3354,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3447,32 +3396,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3493,32 +3440,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3526,7 +3471,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3534,14 +3479,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3556,19 +3501,17 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3836,9 +3779,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3880,32 +3821,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3926,32 +3865,30 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3959,7 +3896,7 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3967,14 +3904,14 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3989,19 +3926,17 @@ internal class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt index bcfe38c07..b20a6a6d3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt @@ -23,7 +23,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .adjustment( SubscriptionUnschedulePendingPlanChangesResponse.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -139,8 +139,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval - .AmountDiscountInterval + SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -194,7 +193,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -281,25 +280,24 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -317,29 +315,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -347,14 +344,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -400,25 +397,24 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -436,29 +432,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -466,14 +461,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -691,9 +686,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -735,32 +728,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -781,32 +772,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -814,7 +803,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -822,14 +811,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -844,19 +833,17 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1124,9 +1111,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1168,32 +1153,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1214,32 +1197,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1247,7 +1228,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1255,14 +1236,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1277,19 +1258,17 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1380,7 +1359,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .adjustment( SubscriptionUnschedulePendingPlanChangesResponse.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1505,8 +1484,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { assertThat(subscriptionUnschedulePendingPlanChangesResponse.discountIntervals()) .containsExactly( SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval.ofAmount( - SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval - .AmountDiscountInterval + SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -1567,7 +1545,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1654,24 +1632,22 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1689,28 +1665,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1718,14 +1694,12 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1768,24 +1742,22 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1803,28 +1775,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1832,14 +1804,12 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2053,8 +2023,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2096,30 +2065,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2139,31 +2106,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2171,7 +2137,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2179,15 +2145,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2199,19 +2164,17 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2468,8 +2431,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2511,30 +2473,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2554,31 +2514,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2586,7 +2545,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2594,15 +2553,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2614,19 +2572,17 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2718,7 +2674,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .adjustment( SubscriptionUnschedulePendingPlanChangesResponse.AdjustmentInterval .Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2834,8 +2790,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval - .AmountDiscountInterval + SubscriptionUnschedulePendingPlanChangesResponse.DiscountInterval.Amount .builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") @@ -2889,7 +2844,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2976,25 +2931,24 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3012,29 +2966,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3042,14 +2995,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3095,25 +3048,24 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3131,29 +3083,28 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3161,14 +3112,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3386,9 +3337,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3430,32 +3379,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3476,32 +3423,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3509,7 +3454,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3517,14 +3462,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3539,19 +3484,17 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3819,9 +3762,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3863,32 +3804,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3909,32 +3848,30 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3942,7 +3879,7 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3950,14 +3887,14 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3972,19 +3909,17 @@ internal class SubscriptionUnschedulePendingPlanChangesResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt index 9069046e5..e48207170 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt @@ -22,7 +22,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustment( SubscriptionUpdateFixedFeeQuantityResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -138,9 +138,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval - .AmountDiscountInterval - .builder() + SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -191,7 +189,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -278,25 +276,24 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -314,29 +311,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -344,14 +340,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -397,25 +393,24 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -433,29 +428,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -463,14 +457,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -688,9 +682,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -732,32 +724,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -778,32 +768,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -811,7 +799,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -819,14 +807,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -841,19 +829,17 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1121,9 +1107,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1165,32 +1149,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1211,32 +1193,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1244,7 +1224,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1252,14 +1232,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1274,19 +1254,17 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1375,7 +1353,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustment( SubscriptionUpdateFixedFeeQuantityResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1497,9 +1475,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { assertThat(subscriptionUpdateFixedFeeQuantityResponse.discountIntervals()) .containsExactly( SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval.ofAmount( - SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval - .AmountDiscountInterval - .builder() + SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1559,7 +1535,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1646,24 +1622,22 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1681,28 +1655,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1710,14 +1684,12 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1760,24 +1732,22 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1795,28 +1765,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1824,14 +1794,12 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2045,8 +2013,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2088,30 +2055,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2131,31 +2096,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2163,7 +2127,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2171,15 +2135,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2191,19 +2154,17 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2460,8 +2421,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2503,30 +2463,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2546,31 +2504,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2578,7 +2535,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2586,15 +2543,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2606,19 +2562,17 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2709,7 +2663,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustment( SubscriptionUpdateFixedFeeQuantityResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2825,9 +2779,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval - .AmountDiscountInterval - .builder() + SubscriptionUpdateFixedFeeQuantityResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2878,7 +2830,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2965,25 +2917,24 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3001,29 +2952,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3031,14 +2981,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3084,25 +3034,24 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3120,29 +3069,28 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3150,14 +3098,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3375,9 +3323,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3419,32 +3365,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3465,32 +3409,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3498,7 +3440,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3506,14 +3448,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3528,19 +3470,17 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3808,9 +3748,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3852,32 +3790,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3898,32 +3834,30 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3931,7 +3865,7 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3939,14 +3873,14 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3961,19 +3895,17 @@ internal class SubscriptionUpdateFixedFeeQuantityResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt index b4bbc2495..e43a83d7e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt @@ -22,7 +22,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustment( SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -137,8 +137,7 @@ internal class SubscriptionUpdateTrialResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUpdateTrialResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionUpdateTrialResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -189,7 +188,7 @@ internal class SubscriptionUpdateTrialResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -276,25 +275,24 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -312,29 +310,28 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -342,14 +339,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -394,25 +391,24 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -430,29 +426,28 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -460,14 +455,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -685,9 +680,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -729,32 +722,30 @@ internal class SubscriptionUpdateTrialResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -775,32 +766,30 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -808,7 +797,7 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -816,14 +805,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -838,19 +827,17 @@ internal class SubscriptionUpdateTrialResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1118,9 +1105,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -1162,32 +1147,30 @@ internal class SubscriptionUpdateTrialResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1208,32 +1191,30 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1241,7 +1222,7 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1249,14 +1230,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -1271,19 +1252,17 @@ internal class SubscriptionUpdateTrialResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -1371,8 +1350,7 @@ internal class SubscriptionUpdateTrialResponseTest { SubscriptionUpdateTrialResponse.AdjustmentInterval.builder() .id("id") .adjustment( - SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1494,8 +1472,7 @@ internal class SubscriptionUpdateTrialResponseTest { assertThat(subscriptionUpdateTrialResponse.discountIntervals()) .containsExactly( SubscriptionUpdateTrialResponse.DiscountInterval.ofAmount( - SubscriptionUpdateTrialResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionUpdateTrialResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1553,7 +1530,7 @@ internal class SubscriptionUpdateTrialResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1640,24 +1617,22 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1675,28 +1650,28 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1704,14 +1679,12 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1753,24 +1726,22 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") - .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() - ) + .billableMetric(Price.Unit.BillableMetric.builder().id("id").build()) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit.DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1788,28 +1759,28 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit.DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1817,14 +1788,12 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() - .unitAmount("unit_amount") - .build() + Price.Unit.UnitConfig.builder().unitAmount("unit_amount").build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -2038,8 +2007,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2081,30 +2049,28 @@ internal class SubscriptionUpdateTrialResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2124,31 +2090,30 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2156,7 +2121,7 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2164,15 +2129,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2184,19 +2148,17 @@ internal class SubscriptionUpdateTrialResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2453,8 +2415,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment.MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -2496,30 +2457,28 @@ internal class SubscriptionUpdateTrialResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2539,31 +2498,30 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -2571,7 +2529,7 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -2579,15 +2537,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration - .builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -2599,19 +2556,17 @@ internal class SubscriptionUpdateTrialResponseTest { .quantity(1.0) .startDate(OffsetDateTime.parse("2022-02-01T08:00:00+00:00")) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -2702,7 +2657,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustment( SubscriptionUpdateTrialResponse.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + .UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -2817,8 +2772,7 @@ internal class SubscriptionUpdateTrialResponseTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - SubscriptionUpdateTrialResponse.DiscountInterval.AmountDiscountInterval - .builder() + SubscriptionUpdateTrialResponse.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -2869,7 +2823,7 @@ internal class SubscriptionUpdateTrialResponseTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -2956,25 +2910,24 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -2992,29 +2945,28 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3022,14 +2974,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3074,25 +3026,24 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration.DurationUnit - .DAY + Price.Unit.BillingCycleConfiguration.DurationUnit.DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3110,29 +3061,28 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration.DurationUnit - .DAY + Price.Unit.InvoicingCycleConfiguration.DurationUnit.DAY ) .build() ) - .item(Price.UnitPrice.Item.builder().id("id").name("name").build()) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3140,14 +3090,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -3365,9 +3315,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3409,32 +3357,30 @@ internal class SubscriptionUpdateTrialResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3455,32 +3401,30 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3488,7 +3432,7 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3496,14 +3440,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3518,19 +3462,17 @@ internal class SubscriptionUpdateTrialResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() @@ -3798,9 +3740,7 @@ internal class SubscriptionUpdateTrialResponseTest { .id("id") .adjustedSubtotal("5.00") .addAdjustment( - Invoice.LineItem.Adjustment - .MonetaryUsageDiscountAdjustment - .builder() + Invoice.LineItem.Adjustment.UsageDiscount.builder() .id("id") .amount("amount") .addAppliesToPriceId("string") @@ -3842,32 +3782,30 @@ internal class SubscriptionUpdateTrialResponseTest { .name("Fixed Fee") .partiallyInvoicedAmount("4.00") .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() + Price.Unit.BillableMetric.builder() .id("id") .build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration - .builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -3888,32 +3826,30 @@ internal class SubscriptionUpdateTrialResponseTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration - .builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice - .InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() + Price.Unit.Item.builder() .id("id") .name("name") .build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -3921,7 +3857,7 @@ internal class SubscriptionUpdateTrialResponseTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -3929,14 +3865,14 @@ internal class SubscriptionUpdateTrialResponseTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration + Price.Unit.DimensionalPriceConfiguration .builder() .addDimensionValue("string") .dimensionalPriceGroupId( @@ -3951,19 +3887,17 @@ internal class SubscriptionUpdateTrialResponseTest { OffsetDateTime.parse("2022-02-01T08:00:00+00:00") ) .addSubLineItem( - Invoice.LineItem.SubLineItem.MatrixSubLineItem.builder() + Invoice.LineItem.SubLineItem.Matrix.builder() .amount("9.00") .grouping( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .Grouping + Invoice.LineItem.SubLineItem.Matrix.Grouping .builder() .key("region") .value("west") .build() ) .matrixConfig( - Invoice.LineItem.SubLineItem.MatrixSubLineItem - .MatrixConfig + Invoice.LineItem.SubLineItem.Matrix.MatrixConfig .builder() .addDimensionValue("string") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt index 4958d5a2d..8939226f3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt @@ -23,8 +23,7 @@ internal class SubscriptionsTest { Subscription.AdjustmentInterval.builder() .id("id") .adjustment( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + Subscription.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -144,7 +143,7 @@ internal class SubscriptionsTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - Subscription.DiscountInterval.AmountDiscountInterval.builder() + Subscription.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -193,7 +192,7 @@ internal class SubscriptionsTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -282,28 +281,26 @@ internal class SubscriptionsTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -323,30 +320,27 @@ internal class SubscriptionsTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -354,7 +348,7 @@ internal class SubscriptionsTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -362,14 +356,14 @@ internal class SubscriptionsTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -417,28 +411,26 @@ internal class SubscriptionsTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -458,30 +450,27 @@ internal class SubscriptionsTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -489,7 +478,7 @@ internal class SubscriptionsTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -497,14 +486,14 @@ internal class SubscriptionsTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -547,9 +536,7 @@ internal class SubscriptionsTest { Subscription.AdjustmentInterval.builder() .id("id") .adjustment( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment - .builder() + Subscription.AdjustmentInterval.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -664,7 +651,7 @@ internal class SubscriptionsTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - Subscription.DiscountInterval.AmountDiscountInterval.builder() + Subscription.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -713,7 +700,7 @@ internal class SubscriptionsTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -802,26 +789,25 @@ internal class SubscriptionsTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -841,32 +827,29 @@ internal class SubscriptionsTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -874,14 +857,14 @@ internal class SubscriptionsTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -925,26 +908,25 @@ internal class SubscriptionsTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder().id("id").build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration - .DurationUnit + Price.Unit.BillingCycleConfiguration.DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -964,32 +946,29 @@ internal class SubscriptionsTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration - .DurationUnit + Price.Unit.InvoicingCycleConfiguration.DurationUnit .DAY ) .build() ) - .item( - Price.UnitPrice.Item.builder().id("id").name("name").build() - ) + .item(Price.Unit.Item.builder().id("id").name("name").build()) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -997,14 +976,14 @@ internal class SubscriptionsTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId("dimensional_price_group_id") .build() @@ -1048,8 +1027,7 @@ internal class SubscriptionsTest { Subscription.AdjustmentInterval.builder() .id("id") .adjustment( - Subscription.AdjustmentInterval.Adjustment - .PlanPhaseUsageDiscountAdjustment + Subscription.AdjustmentInterval.Adjustment.UsageDiscount .builder() .id("id") .addAppliesToPriceId("string") @@ -1169,7 +1147,7 @@ internal class SubscriptionsTest { ) .defaultInvoiceMemo("default_invoice_memo") .addDiscountInterval( - Subscription.DiscountInterval.AmountDiscountInterval.builder() + Subscription.DiscountInterval.Amount.builder() .amountDiscount("amount_discount") .addAppliesToPriceId("string") .addAppliesToPriceIntervalId("string") @@ -1218,7 +1196,7 @@ internal class SubscriptionsTest { Plan.builder() .id("id") .addAdjustment( - Plan.Adjustment.PlanPhaseUsageDiscountAdjustment.builder() + Plan.Adjustment.UsageDiscount.builder() .id("id") .addAppliesToPriceId("string") .isInvoiceLevel(true) @@ -1307,28 +1285,26 @@ internal class SubscriptionsTest { .build() ) .addPrice( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1348,30 +1324,27 @@ internal class SubscriptionsTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1379,7 +1352,7 @@ internal class SubscriptionsTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1387,14 +1360,14 @@ internal class SubscriptionsTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" @@ -1442,28 +1415,26 @@ internal class SubscriptionsTest { .build() ) .price( - Price.UnitPrice.builder() + Price.Unit.builder() .id("id") .billableMetric( - Price.UnitPrice.BillableMetric.builder() - .id("id") - .build() + Price.Unit.BillableMetric.builder().id("id").build() ) .billingCycleConfiguration( - Price.UnitPrice.BillingCycleConfiguration.builder() + Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.BillingCycleConfiguration + Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) .build() ) - .cadence(Price.UnitPrice.Cadence.ONE_TIME) + .cadence(Price.Unit.Cadence.ONE_TIME) .conversionRate(0.0) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditAllocation( - Price.UnitPrice.CreditAllocation.builder() + Price.Unit.CreditAllocation.builder() .allowsRollover(true) .currency("currency") .build() @@ -1483,30 +1454,27 @@ internal class SubscriptionsTest { .externalPriceId("external_price_id") .fixedPriceQuantity(0.0) .invoicingCycleConfiguration( - Price.UnitPrice.InvoicingCycleConfiguration.builder() + Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - Price.UnitPrice.InvoicingCycleConfiguration + Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .item( - Price.UnitPrice.Item.builder() - .id("id") - .name("name") - .build() + Price.Unit.Item.builder().id("id").name("name").build() ) .maximum( - Price.UnitPrice.Maximum.builder() + Price.Unit.Maximum.builder() .addAppliesToPriceId("string") .maximumAmount("maximum_amount") .build() ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder() + Price.Unit.Metadata.builder() .putAdditionalProperty( "foo", JsonValue.from("string"), @@ -1514,7 +1482,7 @@ internal class SubscriptionsTest { .build() ) .minimum( - Price.UnitPrice.Minimum.builder() + Price.Unit.Minimum.builder() .addAppliesToPriceId("string") .minimumAmount("minimum_amount") .build() @@ -1522,14 +1490,14 @@ internal class SubscriptionsTest { .minimumAmount("minimum_amount") .name("name") .planPhaseOrder(0L) - .priceType(Price.UnitPrice.PriceType.USAGE_PRICE) + .priceType(Price.Unit.PriceType.USAGE_PRICE) .unitConfig( - Price.UnitPrice.UnitConfig.builder() + Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .dimensionalPriceConfiguration( - Price.UnitPrice.DimensionalPriceConfiguration.builder() + Price.Unit.DimensionalPriceConfiguration.builder() .addDimensionValue("string") .dimensionalPriceGroupId( "dimensional_price_group_id" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt index 24be6c7da..a190d0f33 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt @@ -131,8 +131,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -227,8 +226,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -323,8 +321,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -419,8 +416,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -515,8 +511,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -611,8 +606,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -707,8 +701,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -803,8 +796,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -897,8 +889,7 @@ internal class ErrorHandlingTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt index dece7ff5d..d7e4bf392 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt @@ -98,7 +98,7 @@ internal class ServiceParamsTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt index eec0b310e..17586112f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt @@ -23,7 +23,7 @@ internal class CouponServiceAsyncTest { val couponFuture = couponServiceAsync.create( CouponCreateParams.builder() - .newCouponPercentageDiscount(0.0) + .percentageDiscount(0.0) .redemptionCode("HALFOFF") .durationInMonths(12L) .maxRedemptions(1L) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt index 3ad5c7d29..d37f76e44 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt @@ -82,7 +82,7 @@ internal class CustomerServiceAsyncTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -171,7 +171,7 @@ internal class CustomerServiceAsyncTest { .build() ) .taxConfiguration( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerUpdateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -352,8 +352,7 @@ internal class CustomerServiceAsyncTest { .build() ) .taxConfiguration( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerUpdateByExternalIdParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt index b6cfed26b..b187ea6ed 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt @@ -28,24 +28,22 @@ internal class PlanServiceAsyncTest { .currency("currency") .name("name") .addPrice( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .BillingCycleConfiguration + PlanCreateParams.Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -57,19 +55,17 @@ internal class PlanServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .InvoicingCycleConfiguration + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + PlanCreateParams.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt index 03870fb82..8fb3f09cb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt @@ -28,26 +28,23 @@ internal class PriceServiceAsyncTest { priceServiceAsync.create( PriceCreateParams.builder() .body( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration + PriceCreateParams.Body.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -58,20 +55,17 @@ internal class PriceServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt index 01ea6b855..2241860cf 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt @@ -40,8 +40,7 @@ internal class SubscriptionServiceAsyncTest { .addAddAdjustment( SubscriptionCreateParams.AddAdjustment.builder() .adjustment( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount + SubscriptionCreateParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -84,20 +83,14 @@ internal class SubscriptionServiceAsyncTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Cadence - .ANNUAL + SubscriptionCreateParams.AddPrice.Price.Unit.Cadence.ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.AddPrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -105,14 +98,12 @@ internal class SubscriptionServiceAsyncTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -125,14 +116,12 @@ internal class SubscriptionServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -140,9 +129,7 @@ internal class SubscriptionServiceAsyncTest { .build() ) .metadata( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionCreateParams.AddPrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -201,7 +188,7 @@ internal class SubscriptionServiceAsyncTest { SubscriptionCreateParams.ReplaceAdjustment.builder() .adjustment( SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -243,20 +230,15 @@ internal class SubscriptionServiceAsyncTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionCreateParams.ReplacePrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.ReplacePrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -264,14 +246,12 @@ internal class SubscriptionServiceAsyncTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -284,14 +264,12 @@ internal class SubscriptionServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -299,9 +277,7 @@ internal class SubscriptionServiceAsyncTest { .build() ) .metadata( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionCreateParams.ReplacePrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -502,7 +478,7 @@ internal class SubscriptionServiceAsyncTest { .expiresAtEndOfCadence(true) .build() ) - .addAmountDiscountCreationParamsDiscount(0.0) + .addAmountDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") .filter("my_property > 100 AND my_other_property = 'bar'") @@ -516,21 +492,16 @@ internal class SubscriptionServiceAsyncTest { .maximumAmount(0.0) .minimumAmount(0.0) .price( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.builder() .cadence( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .Cadence + SubscriptionPriceIntervalsParams.Add.Price.Unit.Cadence .ANNUAL ) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .UnitConfig + SubscriptionPriceIntervalsParams.Add.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -538,14 +509,12 @@ internal class SubscriptionServiceAsyncTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -557,14 +526,12 @@ internal class SubscriptionServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -572,9 +539,7 @@ internal class SubscriptionServiceAsyncTest { .build() ) .metadata( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .Metadata + SubscriptionPriceIntervalsParams.Add.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -589,7 +554,7 @@ internal class SubscriptionServiceAsyncTest { SubscriptionPriceIntervalsParams.AddAdjustment.builder() .adjustment( SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -651,7 +616,7 @@ internal class SubscriptionServiceAsyncTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -698,20 +663,16 @@ internal class SubscriptionServiceAsyncTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -720,14 +681,13 @@ internal class SubscriptionServiceAsyncTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + .Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -740,14 +700,13 @@ internal class SubscriptionServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + .Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -755,8 +714,7 @@ internal class SubscriptionServiceAsyncTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -810,7 +768,7 @@ internal class SubscriptionServiceAsyncTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -855,20 +813,17 @@ internal class SubscriptionServiceAsyncTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .builder() .cadence( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -877,15 +832,14 @@ internal class SubscriptionServiceAsyncTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.ReplacePrice .Price - .NewSubscriptionUnitPrice + .Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -898,15 +852,14 @@ internal class SubscriptionServiceAsyncTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.ReplacePrice .Price - .NewSubscriptionUnitPrice + .Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -914,8 +867,7 @@ internal class SubscriptionServiceAsyncTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt index 8e57daf04..d46450b71 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt @@ -43,18 +43,14 @@ internal class LedgerServiceAsyncTest { CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") .body( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .InvoiceSettings + CustomerCreditLedgerCreateEntryParams.Body.Increment.InvoiceSettings .builder() .autoCollection(true) .netTerms(0L) @@ -63,9 +59,7 @@ internal class LedgerServiceAsyncTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata + CustomerCreditLedgerCreateEntryParams.Body.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -94,17 +88,14 @@ internal class LedgerServiceAsyncTest { CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") .body( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .InvoiceSettings .builder() .autoCollection(true) @@ -114,8 +105,7 @@ internal class LedgerServiceAsyncTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt index ca0538b54..8f68b7545 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt @@ -23,7 +23,7 @@ internal class CouponServiceTest { val coupon = couponService.create( CouponCreateParams.builder() - .newCouponPercentageDiscount(0.0) + .percentageDiscount(0.0) .redemptionCode("HALFOFF") .durationInMonths(12L) .maxRedemptions(1L) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt index f7b5d6b4b..278309a61 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt @@ -82,7 +82,7 @@ internal class CustomerServiceTest { .build() ) .taxConfiguration( - CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerCreateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -170,7 +170,7 @@ internal class CustomerServiceTest { .build() ) .taxConfiguration( - CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + CustomerUpdateParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() @@ -338,8 +338,7 @@ internal class CustomerServiceTest { .build() ) .taxConfiguration( - CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration - .builder() + CustomerUpdateByExternalIdParams.TaxConfiguration.Avalara.builder() .taxExempt(true) .taxExemptionCode("tax_exemption_code") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt index 8b0b1099c..a6721a38a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt @@ -28,24 +28,22 @@ internal class PlanServiceTest { .currency("currency") .name("name") .addPrice( - PlanCreateParams.Price.NewPlanUnitPrice.builder() - .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + PlanCreateParams.Price.Unit.builder() + .cadence(PlanCreateParams.Price.Unit.Cadence.ANNUAL) .itemId("item_id") .name("Annual fee") .unitConfig( - PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + PlanCreateParams.Price.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .BillingCycleConfiguration + PlanCreateParams.Price.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -57,19 +55,17 @@ internal class PlanServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration - .builder() + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PlanCreateParams.Price.NewPlanUnitPrice - .InvoicingCycleConfiguration + PlanCreateParams.Price.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + PlanCreateParams.Price.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt index b1012c2ae..369226f02 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt @@ -28,26 +28,23 @@ internal class PriceServiceTest { priceService.create( PriceCreateParams.builder() .body( - PriceCreateParams.Body.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + PriceCreateParams.Body.Unit.builder() + .cadence(PriceCreateParams.Body.Unit.Cadence.ANNUAL) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.Unit.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.BillingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .BillingCycleConfiguration + PriceCreateParams.Body.Unit.BillingCycleConfiguration .DurationUnit .DAY ) @@ -58,20 +55,17 @@ internal class PriceServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration - .builder() + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration.builder() .duration(0L) .durationUnit( - PriceCreateParams.Body.NewFloatingUnitPrice - .InvoicingCycleConfiguration + PriceCreateParams.Body.Unit.InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.Unit.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt index 5c9408750..a2e9dfd3a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt @@ -40,8 +40,7 @@ internal class SubscriptionServiceTest { .addAddAdjustment( SubscriptionCreateParams.AddAdjustment.builder() .adjustment( - SubscriptionCreateParams.AddAdjustment.Adjustment - .NewPercentageDiscount + SubscriptionCreateParams.AddAdjustment.Adjustment.PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -84,20 +83,14 @@ internal class SubscriptionServiceTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Cadence - .ANNUAL + SubscriptionCreateParams.AddPrice.Price.Unit.Cadence.ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.AddPrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -105,14 +98,12 @@ internal class SubscriptionServiceTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -125,14 +116,12 @@ internal class SubscriptionServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -140,9 +129,7 @@ internal class SubscriptionServiceTest { .build() ) .metadata( - SubscriptionCreateParams.AddPrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionCreateParams.AddPrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -201,7 +188,7 @@ internal class SubscriptionServiceTest { SubscriptionCreateParams.ReplaceAdjustment.builder() .adjustment( SubscriptionCreateParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -243,20 +230,15 @@ internal class SubscriptionServiceTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice - .builder() + SubscriptionCreateParams.ReplacePrice.Price.Unit.builder() .cadence( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Cadence + SubscriptionCreateParams.ReplacePrice.Price.Unit.Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .UnitConfig + SubscriptionCreateParams.ReplacePrice.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -264,14 +246,12 @@ internal class SubscriptionServiceTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -284,14 +264,12 @@ internal class SubscriptionServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionCreateParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -299,9 +277,7 @@ internal class SubscriptionServiceTest { .build() ) .metadata( - SubscriptionCreateParams.ReplacePrice.Price - .NewSubscriptionUnitPrice - .Metadata + SubscriptionCreateParams.ReplacePrice.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -494,7 +470,7 @@ internal class SubscriptionServiceTest { .expiresAtEndOfCadence(true) .build() ) - .addAmountDiscountCreationParamsDiscount(0.0) + .addAmountDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") .filter("my_property > 100 AND my_other_property = 'bar'") @@ -508,21 +484,16 @@ internal class SubscriptionServiceTest { .maximumAmount(0.0) .minimumAmount(0.0) .price( - SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice - .builder() + SubscriptionPriceIntervalsParams.Add.Price.Unit.builder() .cadence( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .Cadence + SubscriptionPriceIntervalsParams.Add.Price.Unit.Cadence .ANNUAL ) .currency("currency") .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .UnitConfig + SubscriptionPriceIntervalsParams.Add.Price.Unit.UnitConfig .builder() .unitAmount("unit_amount") .build() @@ -530,14 +501,12 @@ internal class SubscriptionServiceTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -549,14 +518,12 @@ internal class SubscriptionServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice + SubscriptionPriceIntervalsParams.Add.Price.Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -564,9 +531,7 @@ internal class SubscriptionServiceTest { .build() ) .metadata( - SubscriptionPriceIntervalsParams.Add.Price - .NewFloatingUnitPrice - .Metadata + SubscriptionPriceIntervalsParams.Add.Price.Unit.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -581,7 +546,7 @@ internal class SubscriptionServiceTest { SubscriptionPriceIntervalsParams.AddAdjustment.builder() .adjustment( SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -642,7 +607,7 @@ internal class SubscriptionServiceTest { SubscriptionSchedulePlanChangeParams.AddAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -689,20 +654,16 @@ internal class SubscriptionServiceTest { .minimumAmount("1.23") .planPhaseOrder(0L) .price( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice - .builder() + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit.builder() .cadence( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -711,14 +672,13 @@ internal class SubscriptionServiceTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + .Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -731,14 +691,13 @@ internal class SubscriptionServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + .Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -746,8 +705,7 @@ internal class SubscriptionServiceTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.AddPrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.AddPrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -801,7 +759,7 @@ internal class SubscriptionServiceTest { SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.builder() .adjustment( SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment - .NewPercentageDiscount + .PercentageDiscount .builder() .addAppliesToPriceId("price_1") .addAppliesToPriceId("price_2") @@ -846,20 +804,17 @@ internal class SubscriptionServiceTest { .maximumAmount("1.23") .minimumAmount("1.23") .price( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .builder() .cadence( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Cadence .ANNUAL ) .itemId("item_id") .name("Annual fee") .unitConfig( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .UnitConfig .builder() .unitAmount("unit_amount") @@ -868,15 +823,14 @@ internal class SubscriptionServiceTest { .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.ReplacePrice .Price - .NewSubscriptionUnitPrice + .Unit .BillingCycleConfiguration .DurationUnit .DAY @@ -889,15 +843,14 @@ internal class SubscriptionServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( SubscriptionSchedulePlanChangeParams.ReplacePrice .Price - .NewSubscriptionUnitPrice + .Unit .InvoicingCycleConfiguration .DurationUnit .DAY @@ -905,8 +858,7 @@ internal class SubscriptionServiceTest { .build() ) .metadata( - SubscriptionSchedulePlanChangeParams.ReplacePrice.Price - .NewSubscriptionUnitPrice + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price.Unit .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt index 85814fe9c..65c238cc7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt @@ -42,18 +42,14 @@ internal class LedgerServiceTest { CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") .body( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .InvoiceSettings + CustomerCreditLedgerCreateEntryParams.Body.Increment.InvoiceSettings .builder() .autoCollection(true) .netTerms(0L) @@ -62,9 +58,7 @@ internal class LedgerServiceTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .Metadata + CustomerCreditLedgerCreateEntryParams.Body.Increment.Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() @@ -92,17 +86,14 @@ internal class LedgerServiceTest { CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") .body( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams - .builder() + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment.builder() .amount(0.0) .currency("currency") .description("description") .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .InvoiceSettings .builder() .autoCollection(true) @@ -112,8 +103,7 @@ internal class LedgerServiceTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams.Body - .AddIncrementCreditLedgerEntryRequestParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body.Increment .Metadata .builder() .putAdditionalProperty("foo", JsonValue.from("string")) From fca1dab3b6699dcf0c3526e9b37e4d19289d8ab8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 18 May 2025 20:11:58 +0000 Subject: [PATCH 15/18] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 88277273d..c71a786b2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 106 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-e8dad7eee5621fe2ba948dfd00dabf170d9d92ce615a9f04b0f546f4d8bf39ba.yml openapi_spec_hash: 3f6a98e3a1b3a47acebd67a960090ebf -config_hash: 7e523cf79552b8936bd772f2e1025e5f +config_hash: f6da12790e8f46d93592def474d41c69 From 7b5fb07cdbe4b1ac8f41d95de243b913fce60a13 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 15:20:00 +0000 Subject: [PATCH 16/18] chore(docs): grammar improvements --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 6f64d22c6..3011c3423 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,11 +16,11 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Orb please follow the respective company's security reporting guidelines. +or products provided by Orb, please follow the respective company's security reporting guidelines. ### Orb Terms and Policies -Please contact team@withorb.com for any questions or concerns regarding security of our services. +Please contact team@withorb.com for any questions or concerns regarding the security of our services. --- From 1f7beefa05c6cb1356d1973bbcb0955f7eb65fbd Mon Sep 17 00:00:00 2001 From: David Meadows Date: Thu, 22 May 2025 14:57:06 -0700 Subject: [PATCH 17/18] fix(internal): fix name collision errors from Unit import --- .../withorb/api/models/PlanCreateParams.kt | 3 ++- .../kotlin/com/withorb/api/models/Price.kt | 3 ++- .../withorb/api/models/PriceCreateParams.kt | 3 ++- .../api/models/SubscriptionCreateParams.kt | 9 ++++---- .../SubscriptionPriceIntervalsParams.kt | 23 ++++++++++--------- .../SubscriptionSchedulePlanChangeParams.kt | 9 ++++---- 6 files changed, 28 insertions(+), 22 deletions(-) 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 5da7c7eb2..0d7fd9a10 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 @@ -31,6 +31,7 @@ import com.withorb.api.errors.OrbInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.Unit as KUnit import kotlin.jvm.optionals.getOrNull /** This endpoint allows creation of plans including their prices. */ @@ -1497,7 +1498,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } 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 7d170375d..d2dc125f3 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 @@ -29,6 +29,7 @@ import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.Unit as KUnit import kotlin.jvm.optionals.getOrNull /** @@ -324,7 +325,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } 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 5e64c79e0..6a0cf9726 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 @@ -31,6 +31,7 @@ import com.withorb.api.errors.OrbInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.Unit as KUnit import kotlin.jvm.optionals.getOrNull /** @@ -622,7 +623,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } 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 d4ff624e8..edad900fa 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 @@ -32,6 +32,7 @@ import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.Unit as KUnit import kotlin.jvm.optionals.getOrNull /** @@ -3956,7 +3957,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitPercentageDiscount( percentageDiscount: PercentageDiscount ) { @@ -7768,7 +7769,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } @@ -63374,7 +63375,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitPercentageDiscount( percentageDiscount: PercentageDiscount ) { @@ -67154,7 +67155,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } 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 c96fa71ce..6249c83d1 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 @@ -33,6 +33,7 @@ import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.Unit as KUnit import kotlin.jvm.optionals.getOrNull /** @@ -1879,7 +1880,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -2524,7 +2525,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitAmount(amount: Amount) { amount.validate() } @@ -3368,7 +3369,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -4020,7 +4021,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } @@ -64055,7 +64056,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitPercentageDiscount( percentageDiscount: PercentageDiscount ) { @@ -65976,7 +65977,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -66164,7 +66165,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -66887,7 +66888,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -67287,7 +67288,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -67747,7 +67748,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( @@ -67933,7 +67934,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitDateTime(dateTime: OffsetDateTime) {} override fun visitBillingCycleRelative( 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 eed2edfe0..3d9b6d1de 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 @@ -32,6 +32,7 @@ import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.Unit as KUnit import kotlin.jvm.optionals.getOrNull /** @@ -3725,7 +3726,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitPercentageDiscount( percentageDiscount: PercentageDiscount ) { @@ -7537,7 +7538,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } @@ -63041,7 +63042,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitPercentageDiscount( percentageDiscount: PercentageDiscount ) { @@ -66821,7 +66822,7 @@ private constructor( } accept( - object : Visitor { + object : Visitor { override fun visitUnit(unit: Unit) { unit.validate() } From 6ebb28cab2f55011db94b862be5ab01c66630228 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 21:57:44 +0000 Subject: [PATCH 18/18] release: 0.57.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 53 +++++++++++++++++++++++++++++++++++ README.md | 6 ++-- build.gradle.kts | 2 +- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 87d3d84c1..2afb750c5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.56.0" + ".": "0.57.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d6c32c86..e90b36767 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,58 @@ # Changelog +## 0.57.0 (2025-05-22) + +Full Changelog: [v0.56.0...v0.57.0](https://github.com/orbcorp/orb-java/compare/v0.56.0...v0.57.0) + +### ⚠ BREAKING CHANGES + +* **client:** improve some class names +* **client:** extract auto pagination to shared classes +* **client:** **Migration:** - If you were referencing the `AutoPager` class on a specific `*Page` or `*PageAsync` type, then you should instead reference the shared `AutoPager` and `AutoPagerAsync` types, under the `core` package + - `AutoPagerAsync` now has different usage. You can call `.subscribe(...)` on the returned object instead to get called back each page item. You can also call `onCompleteFuture()` to get a future that completes when all items have been processed. Finally, you can call `.close()` on the returned object to stop auto-paginating early + - If you were referencing `getNextPage` or `getNextPageParams`: + - Swap to `nextPage()` and `nextPageParams()` + - Note that these both now return non-optional types (use `hasNextPage()` before calling these, since they will throw if it's impossible to get another page) + +### Features + +* **client:** allow providing some params positionally ([7ddd872](https://github.com/orbcorp/orb-java/commit/7ddd872ee4fb49e2e3f4b6d5938bc9a5ed0e2342)) +* **client:** extract auto pagination to shared classes ([9affbde](https://github.com/orbcorp/orb-java/commit/9affbdee875bdf75fa150d58ed8de23b9d51eaf2)) + + +### Bug Fixes + +* **internal:** fix name collision errors from Unit import ([1f7beef](https://github.com/orbcorp/orb-java/commit/1f7beefa05c6cb1356d1973bbcb0955f7eb65fbd)) + + +### Performance Improvements + +* **internal:** improve compilation+test speed ([f72c4ad](https://github.com/orbcorp/orb-java/commit/f72c4ad7c4604330f2ff972b517b2e3f03f5356f)) + + +### Chores + +* **ci:** only use depot for staging repos ([68dcdd8](https://github.com/orbcorp/orb-java/commit/68dcdd85f1eac797fae1136e383afae1ad5c0e28)) +* **ci:** run on more branches and use depot runners ([ddcc77e](https://github.com/orbcorp/orb-java/commit/ddcc77e1835fe8ec200fbfeb5d0427ef19fb6d25)) +* **docs:** grammar improvements ([7b5fb07](https://github.com/orbcorp/orb-java/commit/7b5fb07cdbe4b1ac8f41d95de243b913fce60a13)) +* **internal:** codegen related update ([9df208b](https://github.com/orbcorp/orb-java/commit/9df208bf6cf18c90cc09bf1f3eba9ba1e5b4c767)) +* **internal:** codegen related update ([7db8db6](https://github.com/orbcorp/orb-java/commit/7db8db63862be728dc201e36aa3ff164307c5e4e)) +* **internal:** java 17 -> 21 on ci ([7f2fb10](https://github.com/orbcorp/orb-java/commit/7f2fb1063cd794a4c46fb88203944d4262a0a1db)) +* **internal:** remove flaky `-Xbackend-threads=0` option ([b085373](https://github.com/orbcorp/orb-java/commit/b085373fc56676f510a0b0900e8cecd2af633313)) +* **internal:** update java toolchain ([2b4abdf](https://github.com/orbcorp/orb-java/commit/2b4abdff056e4bd158c6a2bc605c4ba09e4760d0)) + + +### Documentation + +* **client:** update jackson compat error message ([b3ceb27](https://github.com/orbcorp/orb-java/commit/b3ceb2741476209419bd210d7caebec7fbb5eaa7)) +* explain http client customization ([31827ac](https://github.com/orbcorp/orb-java/commit/31827acf060986c871832a7619f09dae7aab1640)) +* explain jackson compat in readme ([fb2505d](https://github.com/orbcorp/orb-java/commit/fb2505d8cdf9fb61589715396da17d424de5f7c0)) + + +### Refactors + +* **client:** improve some class names ([9460c52](https://github.com/orbcorp/orb-java/commit/9460c523ec5235f4b8b6335336be8e3b82b8527f)) + ## 0.56.0 (2025-04-09) Full Changelog: [v0.55.0...v0.56.0](https://github.com/orbcorp/orb-java/compare/v0.55.0...v0.56.0) diff --git a/README.md b/README.md index d6e5ded06..fd591b889 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.56.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.57.0) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-java:0.56.0") +implementation("com.withorb.api:orb-java:0.57.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.56.0") com.withorb.api orb-java - 0.56.0 + 0.57.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 3973ccca1..5f8408360 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.56.0" // x-release-please-version + version = "0.57.0" // x-release-please-version }